diff options
author | Jeremy Evans <code@jeremyevans.net> | 2019-07-26 17:04:13 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2019-07-26 17:05:46 -0700 |
commit | 8bccbf3cfea8c1059d40db5b5e61900cf6cf29d3 (patch) | |
tree | f6330438d30f097ca3443d3317e7ddc05eb79287 | |
parent | 6279cf8b2b2a683cb9e4f6422e6f6f9351cff37b (diff) | |
download | ruby-8bccbf3cfea8c1059d40db5b5e61900cf6cf29d3.tar.gz |
Add more documentation on #eql?/#hash relationship [ci skip]
Fixes [Bug #14263]
-rw-r--r-- | object.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -186,7 +186,11 @@ rb_eql(VALUE obj1, VALUE obj2) * * 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 - * 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 * #eql? to their overridden #== method, but there are exceptions. * Numeric types, for example, perform type conversion across #==, |