12件ヒット
[1-12件を表示]
(0.194秒)
クラス
-
Fiddle
:: Closure :: BlockCaller (1) -
Fiddle
:: Function (1) - Hash (1)
- Method (1)
- Module (1)
- Thread (1)
-
Thread
:: Backtrace :: Location (1) - TracePoint (1)
モジュール
- Enumerable (4)
キーワード
-
absolute
_ path (1) -
default
_ proc (1) -
defined
_ class (1) - detect (2)
- find (2)
-
instance
_ method (1) -
set
_ trace _ func (1) -
super
_ method (1)
検索結果
先頭5件
-
Fiddle
:: Closure :: BlockCaller # call(*args) -> object (108607.0) -
wrap しているブロックを呼び出します。
wrap しているブロックを呼び出します。
そのブロックの返り値がこのメソッドの返り値となります。
@param args 引数 -
Fiddle
:: Function # call(*args) -> Integer|DL :: CPtr|nil (90907.0) -
関数を呼び出します。
関数を呼び出します。
Fiddle::Function.new で指定した引数と返り値の型に基いて
Ruby のオブジェクトを適切に C のデータに変換して C の関数を呼び出し、
その返り値を Ruby のオブジェクトに変換して返します。
引数の変換は以下の通りです。
: void* (つまり任意のポインタ型)
nil ならば C の NULL に変換されます
Fiddle::Pointer は保持している C ポインタに変換されます。
文字列であればその先頭ポインタになります。
IO オブジェクトであれば FILE* が渡されます。
整数であればそれがアドレスとみ... -
Hash
# default _ proc -> Proc | nil (54922.0) -
ハッシュのデフォルト値を返す Proc オブジェクトを返します。 ハッシュがブロック形式のデフォルト値を持たない場合 nil を返します。
ハッシュのデフォルト値を返す Proc オブジェクトを返します。
ハッシュがブロック形式のデフォルト値を持たない場合 nil を返します。
//emlist[例][ruby]{
h = Hash.new {|hash, key| "The #{key} not exist in #{hash.inspect}"}
p h.default #=> nil
p block = h.default_proc #=> #<Proc:0x0x401a9ff4>
p block.call({},:foo) #=> "The foo not exist in {}"
h... -
Thread
:: Backtrace :: Location # absolute _ path -> String (45640.0) -
self が表すフレームの絶対パスを返します。
self が表すフレームの絶対パスを返します。
//emlist[例][ruby]{
# foo.rb
class Foo
attr_accessor :locations
def initialize(skip)
@locations = caller_locations(skip)
end
end
Foo.new(0..2).locations.map do |call|
puts call.absolute_path
end
# => /path/to/foo.rb
# /path/to/foo.rb
# /path/to/foo.rb
//}
@see... -
TracePoint
# defined _ class -> Class | module (37258.0) -
メソッドを定義したクラスかモジュールを返します。
メソッドを定義したクラスかモジュールを返します。
//emlist[例][ruby]{
class C; def foo; end; end
trace = TracePoint.new(:call) do |tp|
p tp.defined_class # => C
end.enable do
C.new.foo
end
//}
メソッドがモジュールで定義されていた場合も(include に関係なく)モジュー
ルを返します。
//emlist[例][ruby]{
module M; def foo; end; end
class C; include M; end;
trac... -
Method
# super _ method -> Method | nil (37240.0) -
self 内で super を実行した際に実行されるメソッドを Method オブジェ クトにして返します。
self 内で super を実行した際に実行されるメソッドを Method オブジェ
クトにして返します。
@see UnboundMethod#super_method
//emlist[例][ruby]{
class Super
def foo
"superclass method"
end
end
class Sub < Super
def foo
"subclass method"
end
end
m = Sub.new.method(:foo) # => #<Method: Sub#foo>
m.call # => "subclass me... -
Module
# instance _ method(name) -> UnboundMethod (36976.0) -
self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。
@param name メソッド名を Symbol または String で指定します。
@raise NameError self に存在しないメソッドを指定した場合に発生します。
@see Module#public_instance_method, Object#method
//emlist[例][ruby]{
class Interpreter
def do_a() print "there, "; end
def do_d() print "Hello ";... -
Enumerable
# detect(ifnone = nil) -> Enumerator (36940.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
要素に対してブロックを評価した値が真になった最初の要素を返します。
真になる要素が見つからず、ifnone も指定されていないときは nil を返します。
真になる要素が見つからず、ifnone が指定されているときは ifnone を call した結果を返します。
ブロックを省略した場合は Enumerator を返します。
@param ifnone call メソッドを持つオブジェクト (例えば Proc) を指定します。
//emlist[例][ruby]{
# 最初の 3 の倍数を探す
p [1, 2, 3, 4, 5].find {|i| i % 3 == 0 } ... -
Enumerable
# find(ifnone = nil) -> Enumerator (36940.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
要素に対してブロックを評価した値が真になった最初の要素を返します。
真になる要素が見つからず、ifnone も指定されていないときは nil を返します。
真になる要素が見つからず、ifnone が指定されているときは ifnone を call した結果を返します。
ブロックを省略した場合は Enumerator を返します。
@param ifnone call メソッドを持つオブジェクト (例えば Proc) を指定します。
//emlist[例][ruby]{
# 最初の 3 の倍数を探す
p [1, 2, 3, 4, 5].find {|i| i % 3 == 0 } ... -
Enumerable
# detect(ifnone = nil) {|item| . . . } -> object (36640.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
要素に対してブロックを評価した値が真になった最初の要素を返します。
真になる要素が見つからず、ifnone も指定されていないときは nil を返します。
真になる要素が見つからず、ifnone が指定されているときは ifnone を call した結果を返します。
ブロックを省略した場合は Enumerator を返します。
@param ifnone call メソッドを持つオブジェクト (例えば Proc) を指定します。
//emlist[例][ruby]{
# 最初の 3 の倍数を探す
p [1, 2, 3, 4, 5].find {|i| i % 3 == 0 } ... -
Enumerable
# find(ifnone = nil) {|item| . . . } -> object (36640.0) -
要素に対してブロックを評価した値が真になった最初の要素を返します。
要素に対してブロックを評価した値が真になった最初の要素を返します。
真になる要素が見つからず、ifnone も指定されていないときは nil を返します。
真になる要素が見つからず、ifnone が指定されているときは ifnone を call した結果を返します。
ブロックを省略した場合は Enumerator を返します。
@param ifnone call メソッドを持つオブジェクト (例えば Proc) を指定します。
//emlist[例][ruby]{
# 最初の 3 の倍数を探す
p [1, 2, 3, 4, 5].find {|i| i % 3 == 0 } ... -
Thread
# set _ trace _ func(pr) -> Proc | nil (27694.0) -
スレッドにトレース用ハンドラを設定します。
スレッドにトレース用ハンドラを設定します。
nil を渡すとトレースを解除します。
設定したハンドラを返します。
//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]
#...