るりまサーチ (Ruby 2.3.0)

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

別のキーワード

  1. _builtin equal?
  2. hash equal?
  3. object equal?
  4. struct equal?
  5. basicobject equal?

ライブラリ

検索結果

Object#==(other) -> bool (54397.0)

オブジェクトと other が等しければ真を返します。

...ォルトでは equal? と同じオブジェクト
の同一性判定になっています。

@param other 比較するオブジェクトです。

//emlist[][ruby]{
p("foo" == "bar") #=> false
p("foo" == "foo") #=> true

p(4 == 4) #=> true
p(4 == 4.0) #=> true
//}

@see Object#equal?,Object#eql?...

Object#eql?(other) -> bool (43.0)

オブジェクトと other が等しければ真を返します。Hash で二つのキー が等しいかどうかを判定するのに使われます。

... Object#hash メソッ
ドも再定義しなければなりません。

@param other 比較するオブジェクトです。

//emlist[][ruby]{
p("foo".eql?("bar")) #=> false
p("foo".eql?("foo")) #=> true

p(4.eql?(4)) #=> true
p(4.eql?(4.0)) #=> false
//}

@see Object#hash,Object#equal?,Object#==...