2件ヒット
[1-2件を表示]
(0.286秒)
クラス
- Binding (1)
- TracePoint (1)
検索結果
-
Binding
# local _ variables -> [Symbol] (78385.0) -
ローカル変数の一覧を Symbol の配列で返します。
ローカル変数の一覧を Symbol の配列で返します。
//emlist[例][ruby]{
def foo
a = 1
2.times do |n|
binding.local_variables #=> [:a, :n]
end
end
//}
このメソッドは以下のコードと同様の動作をします。
//emlist[][ruby]{
binding.eval("local_variables")
//} -
TracePoint
# binding -> Binding (24064.0) -
発生したイベントによって生成された Binding オブジェクトを返します。
発生したイベントによって生成された Binding オブジェクトを返します。
//emlist[例][ruby]{
def foo(ret)
ret
end
trace = TracePoint.new(:call) do |tp|
p tp.binding.local_variables # => [:ret]
end
trace.enable
foo 1
//}