るりまサーチ (Ruby 2.1.0)

最速Rubyリファレンスマニュアル検索!
3件ヒット [1-3件を表示] (0.050秒)
トップページ > クラス:Object[x] > クエリ:_builtin[x] > バージョン:2.1.0[x] > クエリ:equal?[x]

別のキーワード

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

ライブラリ

キーワード

検索結果

Object#equal?(other) -> bool (78322.0)

other が self 自身の時、真を返します。

...Object#object_idが一致する
かどうかを調べます。

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

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

p(4.equal?(4)) #=> true
p(4.equal?(4.0)) #=> false

p(:foo.equal? :foo) #=> true
//}

@see Object...
...#object_id,Object#==,Object#eql?,Symbol...

Object#==(other) -> bool (24022.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 (24022.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#==...