14件ヒット
[1-14件を表示]
(0.007秒)
ライブラリ
- ビルトイン (14)
検索結果
-
UnboundMethod
# eql?(other) -> bool (15101.0) -
自身と other が同じクラスあるいは同じモジュールの同じメソッドを表す場合に true を返します。そうでない場合に false を返します。
自身と other が同じクラスあるいは同じモジュールの同じメソッドを表す場合に
true を返します。そうでない場合に false を返します。
@param other 自身と比較したいオブジェクトを指定します。
a = String.instance_method(:size)
b = String.instance_method(:size)
p a == b #=> true
c = Array.instance_method(:size)
p a == c ... -
UnboundMethod
# hash -> Integer (13.0) -
自身のハッシュ値を返します。
...ます。
eql? が真でも hash が一致しない場合があるので Array#uniq などが意図通り動作しないことがあります。
この挙動はバグなので Ruby2.0.0 以降では修正済みです。42755
a = method(:==).unbind
b = method(:eql?).unbind
p a.eql? b......自身のハッシュ値を返します。
a = method(:==).unbind
b = method(:eql?).unbind
p a.eql? b # => true
p a.hash == b.hash # => true
p [a, b].uniq.size # => 1...