1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Add more documentation on #eql?/#hash relationship [ci skip]

Fixes [Bug #14263]
This commit is contained in:
Jeremy Evans 2019-07-26 17:04:13 -07:00
parent 6279cf8b2b
commit 8bccbf3cfe

View file

@ -186,7 +186,11 @@ rb_eql(VALUE obj1, VALUE obj2)
* *
* The #eql? method returns <code>true</code> if +obj+ and +other+ * The #eql? method returns <code>true</code> if +obj+ and +other+
* refer to the same hash key. This is used by Hash to test members * refer to the same hash key. This is used by Hash to test members
* for equality. For objects of class Object, #eql? is synonymous * for equality. For any pair of objects where #eql? returns +true+,
* the #hash value of both objects must be equal. So any subclass
* that overrides #eql? should also override #hash appropriately.
*
* For objects of class Object, #eql? is synonymous
* with #==. Subclasses normally continue this tradition by aliasing * with #==. Subclasses normally continue this tradition by aliasing
* #eql? to their overridden #== method, but there are exceptions. * #eql? to their overridden #== method, but there are exceptions.
* Numeric types, for example, perform type conversion across #==, * Numeric types, for example, perform type conversion across #==,