67件ヒット
[1-67件を表示]
(0.027秒)
キーワード
- drb (11)
- irb (11)
- logger (11)
- pp (11)
-
shell
/ command-processor (6) -
shell
/ process-controller (6) -
webrick
/ httpservlet / prochandler (11)
検索結果
-
webrick
/ httpservlet / prochandler (6017.0) -
Proc を扱うためのサーブレットを提供するライブラリです。
...Proc を扱うためのサーブレットを提供するライブラリです。... -
shell
/ command-processor (6001.0) -
Shell で使用可能なコマンドの大半を定義するライブラリです。
Shell で使用可能なコマンドの大半を定義するライブラリです。 -
shell
/ process-controller (6001.0) -
プロセスを制御するためのクラスを定義したライブラリです。
プロセスを制御するためのクラスを定義したライブラリです。 -
pp (25.0)
-
オブジェクトなどを見やすく出力するためのライブラリです。
...せん。
=== どちらが読みやすいでしょうか?
p による pretty-print されてない出力:
#<PP:0x81a0d10 @stack=[], @genspace=#<Proc:0x81a0cc0>, @nest=[0], @newline="\n",
@buf=#<PrettyPrint::Group:0x81a0c98 @group=0, @tail=0, @buf=[#<PrettyPrint::Gro
up:0x81a0ba8 @group=1, @......], @singleline_width=1>, #
<PrettyPrint::Text:0x81a0a7c @tail=0, @width=1, @text=",">, #<PrettyPrint::Break
able:0x81a0a2c @group=2, @gensace=#<Proc:0x81a0cc0>, @newline="\n", @indent=1, @
tail=2, @sep=" ", @width=1>, #<PrettyPrint::Group:0x81a09c8 @group=2, @tail=1, @
buf=[#<PrettyPrint::Te......tail=1>,
#<PrettyPrint::Text:0x40d053e @tail=0, @text=",", @width=1>,
#<PrettyPrint::Breakable:0x40d0516
@genspace=#<Proc:0x40d0656>,
@group=2,
@indent=1,
@newline="\n",
@sep=" ",
@tail=2,
@width=1>,... -
irb (19.0)
-
irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。
...-d $DEBUG を true にする (ruby -d と同じ)
-w ruby -w と同じ
-W[level=2] ruby -W と同じ
-r library ruby -r と同じ
-I ruby -I と同じ
-U ruby -U と同じ
-E enc ruby -E と同じ
--ve......す。
そこで、IRB.conf[:IRB_RC] を使う方法を紹介します。
IRB.conf[:IRB_RC] に Proc オブジェクトを設定しておくと、
サブ irb が起動されるたびに、その Proc オブジェクトに
IRB::Context オブジェクトを渡して実行します。
これによっ......とができます。
以下に例を示します。
$ irb
irb(main):001:0> IRB.conf[:IRB_RC] = lambda {|conf| conf.prompt_i = "> " }
=> #<Proc:0x00002a95fa3fd8@(irb):2>
irb(main):002:0> irb
>
=== irb の使用例
irb のいろいろな使用例を以下に示します。
$ irb
ir... -
logger (13.0)
-
ログを記録するためのライブラリです。
...[ruby]{
logger.formatter = proc do |severity, datetime, progname, msg|
"#{datetime}: #{msg}\n"
end
# => "2005-09-22 08:51:08 +0900: hello world"
//}
コンストラクタでも同様にできます。
//emlist[][ruby]{
require 'logger'
Logger.new(logdev, formatter: proc {|severity, datetime, pro... -
drb (7.0)
-
分散オブジェクトプログラミングのためのライブラリです。
...トに
DRb::DRbUndumped を Module#include します。
dRuby はブロック付きのメソッド呼び出しをサポートしていますが、
Proc はマーシャリング不可能なので、ブロックの中身は
(リモート側でなく)ローカルプロセス上で実行されます。... -
logger (7.0)
-
ログを記録するためのライブラリです。
...-01-03 00:54:26"
//}
Logger#formatter= を用いてフォーマットを変更することもできます。
//emlist[][ruby]{
logger.formatter = proc do |severity, datetime, progname, msg|
"#{datetime}: #{msg}\n"
end
# => "2005-09-22 08:51:08 +0900: hello world"
//}
=== 参考
: Rubyist Mag...