[DOC] Tweaks for Hash#assoc (#12726)
This commit is contained in:
parent
57b9b92193
commit
7fd589c7fc
Notes:
git
2025-02-10 19:31:59 +00:00
Merged-By: peterzhu2118 <peter@peterzhu.ca>
8
hash.c
8
hash.c
@ -4158,13 +4158,15 @@ assoc_i(VALUE key, VALUE val, VALUE arg)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* hash.assoc(key) -> new_array or nil
|
* assoc(key) -> entry or nil
|
||||||
|
*
|
||||||
|
* If the given +key+ is found, returns its entry as a 2-element array
|
||||||
|
* containing that key and its value:
|
||||||
*
|
*
|
||||||
* If the given +key+ is found, returns a 2-element Array containing that key and its value:
|
|
||||||
* h = {foo: 0, bar: 1, baz: 2}
|
* h = {foo: 0, bar: 1, baz: 2}
|
||||||
* h.assoc(:bar) # => [:bar, 1]
|
* h.assoc(:bar) # => [:bar, 1]
|
||||||
*
|
*
|
||||||
* Returns +nil+ if key +key+ is not found.
|
* Returns +nil+ if the key is not found.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user