るりまサーチ

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

別のキーワード

  1. objectspace each_object
  2. _builtin each_object
  3. object send
  4. object to_enum
  5. object public_send

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

Addrinfo#bind {|sock| ... } -> object (18310.0)

自身のアドレスにバインドされたソケットを作成します。

...がメソッドの返り値となります。
ブロックを省略した場合は、生成された Socket
オブジェクトが返されます。

require 'socket'

Addrinfo.udp("0.0.0.0", 9981).bind {|s|
s.local_address.connect {|s| s.send "hello", 0 }
p s.recv(10) #=> "hello"
}...

Addrinfo#bind -> Socket (18210.0)

自身のアドレスにバインドされたソケットを作成します。

...がメソッドの返り値となります。
ブロックを省略した場合は、生成された Socket
オブジェクトが返されます。

require 'socket'

Addrinfo.udp("0.0.0.0", 9981).bind {|s|
s.local_address.connect {|s| s.send "hello", 0 }
p s.recv(10) #=> "hello"
}...

UnboundMethod#bind_call(recv, *args) -> object (6345.0)

self を recv に bind して args を引数として呼び出します。

...self を recv に bind して args を引数として呼び出します。

self.bind(recv).call(*args) と同じ意味です。

//emlist[][ruby]{
puts Kernel.instance_method(:inspect).bind_call(BasicObject.new) # => #<BasicObject:0x000055c65e8ea7b8>
//}

@see UnboundMethod#bind, Method#call...

UnboundMethod#bind_call(recv, *args) { ... } -> object (6345.0)

self を recv に bind して args を引数として呼び出します。

...self を recv に bind して args を引数として呼び出します。

self.bind(recv).call(*args) と同じ意味です。

//emlist[][ruby]{
puts Kernel.instance_method(:inspect).bind_call(BasicObject.new) # => #<BasicObject:0x000055c65e8ea7b8>
//}

@see UnboundMethod#bind, Method#call...

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

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

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

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

@see Kernel.#eval...

絞り込み条件を変える

Binding#irb -> object (3202.0)

REPLのセッションを開始します。

...REPLのセッションを開始します。

2.5.0 からは require 'irb' せずに直接 binding.irb を呼び出しても使えるようになりました。

@see irb...

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

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

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

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

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

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

Binding#receiver -> object (3202.0)

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

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

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

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

Tracer#trace_func(event, file, line, id, binding, klass, *) -> object | nil (302.0)

@todo

@todo

Method#===(*args) -> object (217.0)

メソッドオブジェクトに封入されているメソッドを起動します。

...f に渡される引数。

@see UnboundMethod#bind_call
@see spec/safelevel

//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}...
...@param args self に渡される引数。

@see UnboundMethod#bind_call

//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}...

絞り込み条件を変える

Method#[](*args) -> object (217.0)

メソッドオブジェクトに封入されているメソッドを起動します。

...f に渡される引数。

@see UnboundMethod#bind_call
@see spec/safelevel

//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}...
...@param args self に渡される引数。

@see UnboundMethod#bind_call

//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
m[1] # => "foo called with arg 1"
m.call(2) # => "foo called with arg 2"
//}...
<< 1 2 > >>