[DOC] Tweaks to Array#assoc (#11384)

This commit is contained in:
Burdette Lamar 2024-08-16 15:11:55 -05:00 committed by GitHub
parent 1917c8c8f3
commit 77ac853c15
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
Notes: git 2024-08-16 20:12:16 +00:00
Merged-By: peterzhu2118 <peter@peterzhu.ca>

View File

@ -5073,17 +5073,17 @@ rb_ary_times(VALUE ary, VALUE times)
/* /*
* call-seq: * call-seq:
* array.assoc(obj) -> found_array or nil * assoc(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 first element <tt>==</tt> +obj+: * and <tt>ele[0] == object</tt>:
* *
* a = [{foo: 0}, [2, 4], [4, 5, 6], [4, 5]] * a = [{foo: 0}, [2, 4], [4, 5, 6], [4, 5]]
* a.assoc(4) # => [4, 5, 6] * a.assoc(4) # => [4, 5, 6]
* *
* Returns +nil+ if no such element is found. * Returns +nil+ if no such element is found.
* *
* Related: #rassoc. * Related: Array#rassoc.
*/ */
VALUE VALUE