るりまサーチ

最速Rubyリファレンスマニュアル検索!
466件ヒット [1-100件を表示] (0.122秒)
トップページ > クエリ:i[x] > クエリ:IN[x] > クエリ:binding[x]

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. _builtin i
  5. matrix i

検索結果

<< 1 2 3 ... > >>

TracePoint#binding -> Binding | nil (49030.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
//}...

TracePoint#binding -> Binding (49024.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
//}...

Kernel.#binding -> Binding (43030.0)

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

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

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

end

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

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

Proc#binding -> Binding (43024.0)

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

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

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

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

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

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

...//emlist[例][ruby]{
def 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#loc...
...al_variable_get, Binding#local_variable_set...

絞り込み条件を変える

Object::TOPLEVEL_BINDING -> Binding (31024.0)

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

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

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

static VALUE proc_binding(VALUE proc) (30400.0)

static VALUE rb_f_binding(VALUE self) (30400.0)

Binding (30024.0)

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

...トのクラスです。

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

irb (26132.0)

irb は Interactive Ruby の略です。 irb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。

...irb は Interactive Ruby の略です。
i
rb を使うと、Ruby の式を標準入力から簡単に入力・実行することができます。

=== irb の使い方

Ruby さえ知っていれば irb を使うのは簡単です。
i
rb コマンドを実行すると、以下のようなプロン...
...

$ irb
i
rb(main):001:0>

あとは Ruby の式を入力するだけで、その式が実行され、結果が表示されます。

i
rb(main):001:0> 1+2
3
i
rb(main):002:0> class Foo
i
rb(main):003:1> def foo
i
rb(main):004:2> print 1
i
rb(main):005:2> end
i
rb(main):006:1>...
...--back-trace-limit n
バックトレース表示をバックトレースの頭から n、
うしろから n だけ行なう。デフォルト値は 16。
--context-mode n 新しいワークスペースを作成した時に関連する Binding...

絞り込み条件を変える

ObjectSpace.#define_finalizer(obj) {|id| ...} -> Array (24406.0)

obj が解放されるときに実行されるファイナライザ proc を 登録します。同じオブジェクトについて複数回呼ばれたときは置き換えで はなく追加登録されます。固定値 0 と proc を配列にして返します。

...ロックを指定した場合は、そのブロックがファイナライザになります。
obj の回収時にブロックは obj の ID (BasicObject#__id__)を引数とし
て実行されます。
しかし、後述の問題があるのでブロックでファイナライザを登録するの...
...す。proc は obj の回収時に obj の ID を引数として実行されます。

=== 使い方の注意

以下は、define_finalizer の使い方の悪い例です。

//emlist[悪い例][ruby]{
class Foo
def initialize
ObjectSpace.define_finalizer(self) {
puts "foo"
}
end
e...
...おいた方が良いでしょう。

//emlist[例][ruby]{
class Baz
def initialize
ObjectSpace.define_finalizer self, eval(%q{
proc {
raise "baz" rescue puts $!
raise "baz2"
puts "baz3"
}
}, TOPLEVEL_BINDING)
end
end
Baz.new
GC.start

# => baz
//}

@s...
<< 1 2 3 ... > >>