From 8bccbf3cfea8c1059d40db5b5e61900cf6cf29d3 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Fri, 26 Jul 2019 17:04:13 -0700 Subject: [PATCH] Add more documentation on #eql?/#hash relationship [ci skip] Fixes [Bug #14263] --- object.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/object.c b/object.c index 30f2d88831..3aa7cd20d2 100644 --- a/object.c +++ b/object.c @@ -186,7 +186,11 @@ rb_eql(VALUE obj1, VALUE obj2) * * The #eql? method returns true 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 #==,