summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurdetteLamar <burdettelamar@yahoo.com>2025-03-06 17:08:24 -0600
committerPeter Zhu <peter@peterzhu.ca>2025-03-07 09:36:51 -0500
commit8774530ce10bbee5b483b4e7283cc263b246125d (patch)
treeb602ce5c691fb1baceb3cd7b7b6b416aaf8eb231
parent42b75a9c6414eb93fdee777d87a7ad7562edf009 (diff)
[DOC] Tweaks for Hash#rassoc
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12874
-rw-r--r--hash.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/hash.c b/hash.c
index e6418449fa..32180b3c7e 100644
--- a/hash.c
+++ b/hash.c
@@ -4266,13 +4266,16 @@ rassoc_i(VALUE key, VALUE val, VALUE arg)
* call-seq:
* rassoc(value) -> new_array or nil
*
- * Returns a new 2-element Array consisting of the key and value
- * of the first-found entry whose value is <tt>==</tt> to value
- * (see {Entry Order}[rdoc-ref:Hash@Entry+Order]):
+ * Searches +self+ for the first entry whose value is <tt>==</tt> to the given +value+;
+ * see {Entry Order}[rdoc-ref:Hash@Entry+Order].
+ *
+ * If the entry is found, returns its key and value as a 2-element array;
+ * returns +nil+ if not found:
+ *
* h = {foo: 0, bar: 1, baz: 1}
* h.rassoc(1) # => [:bar, 1]
*
- * Returns +nil+ if no such value found.
+ * Related: see {Methods for Fetching}[rdoc-ref:Hash@Methods+for+Fetching].
*/
static VALUE