48件ヒット
[1-48件を表示]
(0.116秒)
検索結果
先頭4件
-
Object
# equal?(other) -> bool (18137.0) -
other が self 自身の時、真を返します。
...が一致する
かどうかを調べます。
@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,Objec... -
Hash
# equal?(other) -> bool (18113.0) -
指定された other が self 自身である場合のみ真を返します。
...指定された other が self 自身である場合のみ真を返します。
@param other 自身と比較したい Hash オブジェクトを指定します。
//emlist[例][ruby]{
p({}.equal?({})) #=> false
a = {}
p a.equal?(a) #=> true
//}
@see Hash#==... -
Object
# ==(other) -> bool (43.0) -
オブジェクトと other が等しければ真を返します。
...が期待されています。
デフォルトでは equal? と同じオブジェクト
の同一性判定になっています。
@param other 比較するオブジェクトです。
//emlist[例][ruby]{
o = Object.new
p(o.eql?(o)) #=> true
p(o.eql?(Object.new)) #=> false
//}
下記の例のよ......うに、各クラスの性質に合わせて再定義されることが期待されています。
//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 (31.0) -
オブジェクトと other が等しければ真を返します。Hash で二つのキー が等しいかどうかを判定するのに使われます。
...ォルトでは equal? と同じオブジェクト
の同一性判定になっています。
このメソッドを再定義した時には Object#hash メソッ
ドも再定義しなければなりません。
@param other 比較するオブジェクトです。
//emlist[][ruby]{
p("foo".eql?("b......ar")) #=> false
p("foo".eql?("foo")) #=> true
p(4.eql?(4)) #=> true
p(4.eql?(4.0)) #=> false
//}
@see Object#hash,Object#equal?,Object#==...