るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

検索結果

Binding#local_variable_set(symbol, obj) (18138.0)

引数 symbol で指定した名前のローカル変数に引数 obj を設定します。

...す。

@param symbol ローカル変数名を Symbol オブジェクトで指定します。

@param obj 引数 symbol で指定したローカル変数に設定するオブジェクトを指定します。

//emlist[例][ruby]{
def foo
a = 1
bind = binding
bind.local_variable_set(:a, 2) # se...
...ng local variable `a'
bind.local_variable_set(:b, 3) # create new local variable `b'
# `b' exists only in binding
p
bind.local_variable_get(:a) # => 2
p
bind.local_variable_get(:b) # => 3
p
a # => 2
p
b...