るりまサーチ (Ruby 3.3)

最速Rubyリファレンスマニュアル検索!
3件ヒット [1-3件を表示] (0.099秒)

別のキーワード

  1. _builtin local_variables
  2. pp pretty_print_instance_variables
  3. win32ole variables
  4. kernel global_variables
  5. kernel local_variables

ライブラリ

クラス

キーワード

検索結果

TracePoint#binding -> Binding | nil (54712.0)

発生したイベントによって生成された Binding オブジェクトを返します。

発生したイベントによって生成された Binding オブジェクトを返します。

C で記述されたメソッドは binding を生成しないため、
:c_call および :c_return イベントに対しては nil を返すことに注意してください。

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

Binding#local_variables -> [Symbol] (45379.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")
//}

Binding#source_location -> [String, Integer] (27040.0)

self の Ruby のソースファイル名と行番号を返します。

self の Ruby のソースファイル名と行番号を返します。

d:spec/variables#pseudo の __FILE__ と __LINE__ も参照してください。

//emlist[例][ruby]{
p binding.source_location # => ["test.rb", 1]
//}