Skip to content

Commit 471f783

Browse files
Object#eql?を実行する例を追記
既存の例は適切に再定義された例として提示
1 parent 1f4016a commit 471f783

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

refm/api/src/_builtin/Object

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@ p some #=> #<Object:0x2b696d8>
3232

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

35-
#@samplecode
35+
#@samplecode 例
36+
o = Object.new
37+
p(o.eql?(o)) #=> true
38+
p(o.eql?(Object.new)) #=> false
39+
#@end
40+
41+
下記の例のように、各クラスの性質に合わせて再定義されることが期待されています。
42+
43+
#@samplecode 適切に再定義されている例
3644
p("foo" == "bar") #=> false
3745
p("foo" == "foo") #=> true
3846

0 commit comments

Comments
 (0)