[DOC] Tweaks for Array#rassoc

This commit is contained in:
BurdetteLamar 2024-10-08 15:23:41 -05:00 committed by Peter Zhu
parent 9e121ef985
commit 015d9ebaec
Notes: git 2024-10-08 20:55:01 +00:00

10
array.c
View File

@ -5119,17 +5119,19 @@ rb_ary_assoc(VALUE ary, VALUE key)
/* /*
* call-seq: * call-seq:
* array.rassoc(obj) -> found_array or nil * rassoc(object) -> found_array or nil
* *
* Returns the first element in +self+ that is an +Array+ * Returns the first element +ele+ in +self+ such that +ele+ is an array
* whose second element <tt>==</tt> +obj+: * and <tt>ele[1] == object</tt>:
* *
* a = [{foo: 0}, [2, 4], [4, 5, 6], [4, 5]] * a = [{foo: 0}, [2, 4], [4, 5, 6], [4, 5]]
* a.rassoc(4) # => [2, 4] * a.rassoc(4) # => [2, 4]
* a.rassoc(5) # => [4, 5, 6]
* *
* Returns +nil+ if no such element is found. * Returns +nil+ if no such element is found.
* *
* Related: #assoc. * Related: Array#assoc;
* see also {Methods for Fetching}[rdoc-ref:Array@Methods+for+Fetching].
*/ */
VALUE VALUE