72件ヒット
[1-72件を表示]
(0.186秒)
別のキーワード
クラス
- BasicObject (24)
- OptionParser (12)
- Pathname (12)
- Thread (24)
キーワード
-
_ _ send _ _ (24) -
add
_ trace _ func (12) -
on
_ tail (12) -
set
_ trace _ func (12)
検索結果
先頭5件
-
Pathname
# join(*args) -> Pathname (21468.0) -
与えられたパス名を連結します。
...す。
@param args 連結したいディレクトリ名やファイル名を文字列で与えます。
//emlist[例][ruby]{
require "pathname"
path0 = Pathname("/usr") # Pathname:/usr
path0 = path0.join("bin/ruby") # Pathname:/usr/bin/ruby
# 上記の path0 の処理......は下記の path1 と同様のパスになります
path1 = Pathname("/usr") + "bin/ruby" # Pathname:/usr/bin/ruby
path0 == path1 #=> true
//}... -
Thread
# add _ trace _ func(pr) -> Proc (12231.0) -
スレッドにトレース用ハンドラを追加します。
...@param pr トレースハンドラ(Proc オブジェクト)
//emlist[例][ruby]{
th = Thread.new do
class Trace
end
43.to_s
end
th.add_trace_func lambda {|*arg| p arg }
th.join
# => ["line", "example.rb", 4, nil, #<Binding:0x00007f98e107d0d8>, nil]
# => ["c-call", "example.rb", 4, :inherited......8e1087448>, Class]
# => ["c-return", "example.rb", 4, :inherited, #<Binding:0x00007f98e1085d00>, Class]
# => ["class", "example.rb", 4, nil, #<Binding:0x00007f98e108f210>, nil]
# => ["end", "example.rb", 5, nil, #<Binding:0x00007f98e108e5e0>, nil]
# => ["line", "example.rb", 6, nil, #<Binding:0x0000......7f98e108d4b0>, nil]
# => ["c-call", "example.rb", 6, :to_s, #<Binding:0x00007f98e1097aa0>, Integer]
# => ["c-return", "example.rb", 6, :to_s, #<Binding:0x00007f98e1095cc8>, Integer]
//}
@see Thread#set_trace_func Kernel.#set_trace_func... -
Thread
# set _ trace _ func(pr) -> Proc | nil (12231.0) -
スレッドにトレース用ハンドラを設定します。
...。
//emlist[例][ruby]{
th = Thread.new do
class Trace
end
2.to_s
Thread.current.set_trace_func nil
3.to_s
end
th.set_trace_func lambda {|*arg| p arg }
th.join
# => ["line", "example.rb", 2, nil, #<Binding:0x00007fc8de87cb08>, nil]
# => ["c-call", "example.rb", 2, :inherited, #<Binding:......8de886770>, Class]
# => ["c-return", "example.rb", 2, :inherited, #<Binding:0x00007fc8de8844e8>, Class]
# => ["class", "example.rb", 2, nil, #<Binding:0x00007fc8de88e830>, nil]
# => ["end", "example.rb", 3, nil, #<Binding:0x00007fc8de88d6b0>, nil]
# => ["line", "example.rb", 4, nil, #<Binding:0x0000......xample.rb", 4, :to_s, #<Binding:0x00007fc8de896f30>, Integer]
# => ["c-return", "example.rb", 4, :to_s, #<Binding:0x00007fc8de894a50>, Integer]
# => ["line", "example.rb", 5, nil, #<Binding:0x00007fc8de967b08>, nil]
# => ["c-call", "example.rb", 5, :current, #<Binding:0x00007fc8de967798>, Thread]
#... -
OptionParser
# on _ tail(*arg , &block) -> self (9338.0) -
オプションを取り扱うためのブロックを自身の持つリストの最後に登録します。
...-version や --help の説明をサマリの最後に表示したい時に便利です。
@param arg OptionParser#on と同様です。
@param block OptionParser#on と同様です。
//emlist[例][ruby]{
require "optparse"
opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.......te")
opts.on_tail("-h", "--help")
end
puts opts.help
# => Usage: test [options]
# -i, --init
# -u, --update
# -h, --help
//}
//emlist[例][ruby]{
require "optparse"
opts = OptionParser.new
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
opts.on_tail("--ver......sion", "Show version") do
puts OptionParser::Version.join('.')
exit
end
//}
@see OptionParser#on, OptionParser#on_head... -
BasicObject
# _ _ send _ _ (name , *args) -> object (3325.0) -
オブジェクトのメソッド name を args を引数にして呼び出し、メソッドの結果を返します。
...name を args を引数にして呼び出し、メソッドの結果を返します。
ブロック付きで呼ばれたときはブロックもそのまま引き渡します。
@param name 呼び出すメソッドの名前。 Symbol または文字列で指定します。
@param args メソッ......//emlist[例][ruby]{
class Mail
def delete(*args)
"(Mail#delete) - delete " + args.join(',')
end
def send(name, *args)
"(Mail#send) - #{name} #{args.join(',')}"
end
end
mail = Mail.new
mail.send :delete, "gentle", "readers" # => "(Mail#send) - delete gentle,readers"
mail.__se......nd__ :delete, "gentle", "readers" # => "(Mail#delete) - delete gentle,readers"
//}
@see Object#send... -
BasicObject
# _ _ send _ _ (name , *args) { . . . . } -> object (3325.0) -
オブジェクトのメソッド name を args を引数にして呼び出し、メソッドの結果を返します。
...name を args を引数にして呼び出し、メソッドの結果を返します。
ブロック付きで呼ばれたときはブロックもそのまま引き渡します。
@param name 呼び出すメソッドの名前。 Symbol または文字列で指定します。
@param args メソッ......//emlist[例][ruby]{
class Mail
def delete(*args)
"(Mail#delete) - delete " + args.join(',')
end
def send(name, *args)
"(Mail#send) - #{name} #{args.join(',')}"
end
end
mail = Mail.new
mail.send :delete, "gentle", "readers" # => "(Mail#send) - delete gentle,readers"
mail.__se......nd__ :delete, "gentle", "readers" # => "(Mail#delete) - delete gentle,readers"
//}
@see Object#send...