るりまサーチ

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

別のキーワード

  1. _builtin >
  2. bigdecimal >
  3. module >
  4. integer >
  5. float >

ライブラリ

クラス

モジュール

キーワード

検索結果

<< < 1 2 3 4 > >>

Method#unbind -> UnboundMethod (9325.0)

self のレシーバとの関連を取り除いた UnboundMethod オブ ジェクトを生成して返します。

...self のレシーバとの関連を取り除いた UnboundMethod オブ
ジェクトを生成して返します。

//emlist[例][ruby]{
class Foo
def foo
"foo"
e
nd
e
nd

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
unbound_method = m.unbind # => #<UnboundMethod: Foo#foo>
unbound_method....
...bind(Foo.new) # => #<Method: Foo#foo>
//}...

Binding#receiver -> object (9301.0)

保持するコンテキスト内での self を返します。

...保持するコンテキスト内での self を返します。

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

//emlist[][ruby]{
bind
ing.eval("self")
//}...

Gem::Specification#add_bindir(executables) -> Array | nil (9301.0)

実行コマンドの格納場所を返します。

...実行コマンドの格納場所を返します。

@param executables 実行コマンド名を格納した配列を指定します。...

TracePoint#binding -> Binding (9301.0)

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

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


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

TracePoint#binding -> Binding | nil (9301.0)

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

... Binding オブジェクトを返します。

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

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

絞り込み条件を変える

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

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

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

@param expr 評価したい式を文字列で与えます。

@param fname ファイル名を...
... expr が fname というファイル名にあるかのように実行されます。

@param lineno 行番号を整数で与えます。式 expr の先頭行の行番号が lineno であるかのように実行されます。

//emlist[例][ruby]{
def get_binding(str)
bind
ing
e
nd
str = "hello"...
...p eval("str + ' Fred'") #=> "hello Fred"
p get_binding("bye").eval("str + ' Fred'") #=> "bye Fred"
//}

@see Kernel.#eval...

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

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

...に true を、
そうでない場合に false を返します。

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

//emlist[例][ruby]{
def foo
a = 1
bind
ing.local_variable_defined?(:a) # => true
bind
ing.local_variable_defined?(:b) # => false
e
nd
//}

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

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

@see Binding#local_variable_get, Binding#local_variable_set...

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

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

...クトで指定します。

@raise NameError 引数 symbol で指定したローカル変数が未定義の場合に発生します。

//emlist[例][ruby]{
def foo
a = 1
bind
ing.local_variable_get(:a) # => 1
bind
ing.local_variable_get(:b) # => NameError
e
nd
//}

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

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

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

Binding#local_variables -> [Symbol] (9201.0)

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

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

//emlist[例][ruby]{
def foo
a = 1
2.times do |n|
bind
ing.local_variables #=> [:a, :n]
e
nd
e
nd
//}

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

//emlist[][ruby]{
bind
ing.eval("local_variables")
//}...

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

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

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

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

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

絞り込み条件を変える

Gem::Specification#bindir -> String (9201.0)

実行ファイルを格納するディレクトリを返します。

実行ファイルを格納するディレクトリを返します。

IRB::Frame#trace_func(event, file, line, id, binding) -> Binding (6401.0)

ライブラリ内部で使用します。

ライブラリ内部で使用します。
<< < 1 2 3 4 > >>