From 6279cf8b2b2a683cb9e4f6422e6f6f9351cff37b Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Fri, 26 Jul 2019 16:57:42 -0700 Subject: [PATCH] Restore documentation for Object#hash [ci skip] Object#hash documentation was removed (probably by accident) in 7b19e6f3fdf8b0238752cb1561dfe42a283f5308. --- object.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/object.c b/object.c index 6b7a8f2952..30f2d88831 100644 --- a/object.c +++ b/object.c @@ -205,6 +205,25 @@ rb_obj_equal(VALUE obj1, VALUE obj2) return Qfalse; } +/** + * call-seq: + * obj.hash -> integer + * + * Generates an Integer hash value for this object. This function must have the + * property that a.eql?(b) implies a.hash == b.hash. + * + * The hash value is used along with #eql? by the Hash class to determine if + * two objects reference the same hash key. Any hash value that exceeds the + * capacity of an Integer will be truncated before being used. + * + * The hash value for an object may not be identical across invocations or + * implementations of Ruby. If you need a stable identifier across Ruby + * invocations and implementations you will need to generate one with a custom + * method. + *-- + * \private + *++ + */ VALUE rb_obj_hash(VALUE obj); /**