るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.114秒)
トップページ > バージョン:2.6.0[x] > 種類:インスタンスメソッド[x] > クエリ:object[x] > クエリ:|[x] > クラス:TracePoint[x]

別のキーワード

  1. _builtin each_object
  2. objectspace each_object
  3. object send
  4. object to_enum
  5. json object

ライブラリ

キーワード

検索結果

TracePoint#parameters -> [object] (346.0)

現在のフックが属するメソッドまたはブロックのパラメータ定義を返します。 フォーマットは Method#parameters と同じです。

...イベントのためのイベントフックの外側で実行した場合に発生します。

//emlist[例][ruby]{
def foo(a, b = 2)
end
TracePoint
.new(:call) do |tp|
p tp.parameters # => a], [:opt, :b
end.enable do
foo(1)
end
//}

@see Method#parameters, UnboundMethod#parameters, Proc#...

TracePoint#return_value -> object (346.0)

メソッドやブロックの戻り値を返します。

...timeError :return、:c_return、:b_return イベントのためのイベ
ントフックの外側で実行した場合に発生します。

//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:return) do |tp|
p tp.return_value # => 1
end
trace.enable
foo 1
//}...