るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

モジュール

検索結果

<< 1 2 > >>

Addrinfo#bind {|sock| ... } -> object (27308.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(obj) -> Method (24331.0)

self を obj にバインドした Method オブジェクトを生成して返します。

...j にバインドした Method オブジェクトを生成して返します。


@param obj 自身をバインドしたいオブジェクトを指定します。ただしバインドできるのは、
生成元のクラスかそのサブクラスのインスタンスのみです。

@rai...
...se TypeError objbindできないオブジェクトである場合に発生します

//emlist[例][ruby]{
# クラスのインスタンスメソッドの UnboundMethod の場合
class Foo
def foo
"foo"
end
end

# UnboundMethod `m' を生成
p m = Foo.instance_method(:foo) # => #<UnboundMe...
...スをレシーバとする Method オブジェクトを生成
p m.bind(Foo.new) # => #<Method: Foo#foo>

# Foo のサブクラス Bar のインスタンスをレシーバとする Method
class Bar < Foo
end
p m.bind(Bar.new) # => #<Method: Bar(Foo)#foo>


# モジュー...

Object::TOPLEVEL_BINDING -> Binding (21600.0)

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

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

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

UnboundMethod#bind_call(recv, *args) -> object (12336.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 (12336.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...

絞り込み条件を変える

static VALUE method_unbind(VALUE obj) (12300.0)

static VALUE umethod_unbind(VALUE obj) (12300.0)

Binding#local_variable_set(symbol, obj) (12230.0)

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

...obj を設定します。

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

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

//emlist[例][ruby]{
def foo
a = 1
bind
= binding
bind
.local_varia...
...ble_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_variable_get(:b) # => 3
p a # => 2
p...
...# => NameError
end
//}

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

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

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

Binding#irb -> object (12200.0)

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

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

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

@see irb...

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

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

...mbol オブジェクトで指定します。

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

//emlist[例][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 (12200.0)

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

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

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

//emlist[][ruby]{
bind
ing.eval("self")
//}...
<< 1 2 > >>