Skip to content

Commit 236909c

Browse files
authored
Merge pull request #2921 from j-o-lantern0422/fix-equl
Object#eql?の実行例を追記し、既存の例を再定義の例として明示する
2 parents eb4d266 + 471f783 commit 236909c

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)