aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-08-24 09:09:53 -0700
committerJeremy Evans <code@jeremyevans.net>2019-08-24 09:09:53 -0700
commite1c991f8d783440411e5bf4faf3f0923cef4a0e1 (patch)
treed6828d42f29676f4bdf659ed100e3a90025cc740
parentcf5516de7bff474030a820b63788e12f0b8b93d6 (diff)
downloadruby-e1c991f8d783440411e5bf4faf3f0923cef4a0e1.tar.gz
Move Object#hash rdoc to hash.c [ci skip]
This gets RDoc to pick up the documentation correctly. Problem pointed out by zverok (Victor Shepelev).
-rw-r--r--hash.c19
-rw-r--r--object.c21
2 files changed, 20 insertions, 20 deletions
diff --git a/hash.c b/hash.c
index 808544793b..9a863962e7 100644
--- a/hash.c
+++ b/hash.c
@@ -280,6 +280,25 @@ objid_hash(VALUE obj)
#endif
}
+/**
+ * call-seq:
+ * obj.hash -> integer
+ *
+ * Generates an Integer hash value for this object. This function must have the
+ * property that <code>a.eql?(b)</code> implies <code>a.hash == b.hash</code>.
+ *
+ * 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)
{
diff --git a/object.c b/object.c
index c580d01223..78665e039c 100644
--- a/object.c
+++ b/object.c
@@ -209,25 +209,6 @@ 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 <code>a.eql?(b)</code> implies <code>a.hash == b.hash</code>.
- *
- * 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);
/**
@@ -4276,7 +4257,7 @@ InitVM_Object(void)
rb_define_method(rb_mKernel, "=~", rb_obj_match, 1);
rb_define_method(rb_mKernel, "!~", rb_obj_not_match, 1);
rb_define_method(rb_mKernel, "eql?", rb_obj_equal, 1);
- rb_define_method(rb_mKernel, "hash", rb_obj_hash, 0);
+ rb_define_method(rb_mKernel, "hash", rb_obj_hash, 0); /* in hash.c */
rb_define_method(rb_mKernel, "<=>", rb_obj_cmp, 1);
rb_define_method(rb_mKernel, "class", rb_obj_class, 0);