るりまサーチ (Ruby 2.6.0)

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

キーワード

検索結果

Method#unbind -> UnboundMethod (78322.0)

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

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

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

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

UnboundMethod#hash -> Integer (24037.0)

自身のハッシュ値を返します。

自身のハッシュ値を返します。


//emlist[例][ruby]{
a = method(:==).unbind
b = method(:eql?).unbind
p a.eql? b # => true
p a.hash == b.hash # => true
p [a, b].uniq.size # => 1
//}

UnboundMethod (24019.0)

レシーバを持たないメソッドを表すクラスです。 呼び出すためにはレシーバにバインドする必要があります。

レシーバを持たないメソッドを表すクラスです。
呼び出すためにはレシーバにバインドする必要があります。

Module#instance_method や
Method#unbind により生成し、後で
UnboundMethod#bind によりレシーバを
割り当てた Method オブジェクトを作ることができます。

//emlist[例: Method クラスの冒頭にある例を UnboundMethod で書くと以下のようになります。][ruby]{
class Foo
def foo() "foo" end
def bar() "bar" end
def baz() "baz...