mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[DOC] Tweaks for Hash#rassoc
This commit is contained in:
parent
42b75a9c64
commit
8774530ce1
Notes:
git
2025-03-07 14:37:09 +00:00
1 changed files with 7 additions and 4 deletions
11
hash.c
11
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue