るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

キーワード

検索結果

UnboundMethod#bind(obj) -> Method (18174.0)

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

...生成して返します。


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

@
raise TypeError objがbindできないオブジェク...
...トである場合に発生します

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

# UnboundMethod `m' を生成
p m = Foo.instance_method(:foo) # => #<UnboundMethod: Foo#foo>

# Foo のインスタンスをレ...
...シーバとする 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>


# モジュールのイ...

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

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

...ray#[]のような
他の [] メソッドとの意味的な関連性はありません。


@
param args self に渡される引数。

@
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#[](*args) -> object (37.0)

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

...ray#[]のような
他の [] メソッドとの意味的な関連性はありません。


@
param args self に渡される引数。

@
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#call(*args) -> object (37.0)

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

...ray#[]のような
他の [] メソッドとの意味的な関連性はありません。


@
param args self に渡される引数。

@
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#call(*args) { ... } -> object (37.0)

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

...ray#[]のような
他の [] メソッドとの意味的な関連性はありません。


@
param args self に渡される引数。

@
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)...

絞り込み条件を変える

Module#instance_method(name) -> UnboundMethod (37.0)

self のインスタンスメソッド name をオブジェクト化した UnboundMethod を返します。

...ethod を返します。

@
param name メソッド名を Symbol または String で指定します。

@
raise NameError self に存在しないメソッドを指定した場合に発生します。

@
see Module#public_instance_method, Object#method

//emlist[例][ruby]{
class
Interpreter
def do_a...
...d(:do_a),
"d" => instance_method(:do_d),
"e" => instance_method(:do_e),
"v" => instance_method(:do_v)
}
def interpret(string)
string.each_char {|b| Dispatcher[b].bind(self).call }
end
end

interpreter = Interpreter.new
interpreter.interpret('dave')
# => Hello there, Dave!
//}...

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

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

...で、Array#[]のような
他の [] メソッドとの意味的な関連性はありません。


@
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) # => #<Metho...

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

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

...で、Array#[]のような
他の [] メソッドとの意味的な関連性はありません。


@
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) # => #<Metho...

Method#call(*args) -> object (31.0)

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

...で、Array#[]のような
他の [] メソッドとの意味的な関連性はありません。


@
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) # => #<Metho...

Method#call(*args) { ... } -> object (31.0)

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

...で、Array#[]のような
他の [] メソッドとの意味的な関連性はありません。


@
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) # => #<Metho...

絞り込み条件を変える