るりまサーチ

最速Rubyリファレンスマニュアル検索!
226件ヒット [1-100件を表示] (0.075秒)
トップページ > クエリ:d[x] > クエリ:binding[x] > ライブラリ:ビルトイン[x]

別のキーワード

  1. bigdecimal/util to_d
  2. float to_d
  3. rsa d
  4. rsa d=
  5. _builtin $-d

検索結果

<< 1 2 3 > >>

Kernel.#binding -> Binding (24432.0)

変数・メソッドなどの環境情報を含んだ Binding オブジェクトを 生成して返します。通常、Kernel.#eval の第二引数として使います。

...変数・メソッドなどの環境情報を含んだ Binding オブジェクトを
生成して返します。通常、Kernel.#eval の第二引数として使います。

//emlist[例][ruby]{
d
ef foo
a = 1
binding

end

eval("p a", foo) #=> 1
//}

@see Kernel.#eval,Object::TOPLEVEL_BINDING...

TracePoint#binding -> Binding | nil (24432.0)

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

...生成された Binding オブジェクトを返します。

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

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

Proc#binding -> Binding (24426.0)

Proc オブジェクトが保持するコンテキストを Binding オブジェクトで返します。

...Proc オブジェクトが保持するコンテキストを
Binding
オブジェクトで返します。

//emlist[例][ruby]{
d
ef fred(param)
proc {}
end

sample_proc = fred(99)
eval("param", sample_proc.binding) # => 99
//}...

TracePoint#binding -> Binding (24426.0)

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

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


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

Binding#local_variable_defined?(symbol) -> bool (15132.0)

引数 symbol で指定した名前のローカル変数が定義されている場合に true を、 そうでない場合に false を返します。

...[例][ruby]{
d
ef foo
a = 1
binding
.local_variable_defined?(:a) # => true
binding
.local_variable_defined?(:b) # => false
end
//}

このメソッドは以下のコードの短縮形です。

//emlist[][ruby]{
binding
.eval("defined?(#{symbol}) == 'local-variable'")
//}

@see Binding#local_varia...
...ble_get, Binding#local_variable_set...

絞り込み条件を変える

Object::TOPLEVEL_BINDING -> Binding (12426.0)

トップレベルでの Binding オブジェクト。

...トップレベルでの Binding オブジェクト。

詳細は Binding を参照してください。...

Binding#local_variable_get(symbol) -> object (12032.0)

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

...][ruby]{
d
ef foo
a = 1
binding
.local_variable_get(:a) # => 1
binding
.local_variable_get(:b) # => NameError
end
//}

このメソッドは以下のコードの短縮形です。

//emlist[][ruby]{
binding
.eval("#{symbol}")
//}

@see Binding#local_variable_set, Binding#local_variable_defined?...

Binding#local_variable_set(symbol, obj) (12032.0)

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

...[例][ruby]{
d
ef foo
a = 1
bind = binding
bind.local_variable_set(:a, 2) # set existing 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_varia...
...# => NameError
end
//}

このメソッドは以下のコード(ただし、obj が Ruby のコードで出力される場
合)と同様の動作をします。

//emlist[][ruby]{
binding
.eval("#{symbol} = #{obj}")
//}

@see Binding#local_variable_get, Binding#local_variable_defined?...

Binding (12026.0)

ローカル変数のテーブルと self、モジュールのネストなどの情報を保 持するオブジェクトのクラスです。

...トのクラスです。

組み込み関数 Kernel.#binding と Proc#binding によっ
てのみ生成され、Kernel.#eval の第 2 引数に使用します。
またトップレベルの Binding オブジェクトとして組み込み定数
Object::TOPLEVEL_BINDING が用意されています。...

Binding#eval(expr, fname = __FILE__, lineno = 1) -> object (12020.0)

自身をコンテキストとし文字列 expr を Ruby プログラムとして評価しその結果を返します。 組み込み関数 Kernel.#eval を使って eval(expr, self, fname, lineno) とするのと同じです。

...の先頭行の行番号が lineno であるかのように実行されます。

//emlist[例][ruby]{
d
ef get_binding(str)
binding

end
str = "hello"
p eval("str + ' Fred'") #=> "hello Fred"
p get_binding("bye").eval("str + ' Fred'") #=> "bye Fred"
//}

@see Kernel.#eval...

絞り込み条件を変える

Binding#local_variables -> [Symbol] (12014.0)

ローカル変数の一覧を Symbol の配列で返します。

...カル変数の一覧を Symbol の配列で返します。

//emlist[例][ruby]{
d
ef foo
a = 1
2.times do |n|
binding
.local_variables #=> [:a, :n]
end
end
//}

このメソッドは以下のコードと同様の動作をします。

//emlist[][ruby]{
binding
.eval("local_variables")
//}...
<< 1 2 3 > >>