Skip to content

Commit 7fd589c

Browse files
[DOC] Tweaks for Hash#assoc (#12726)
1 parent 57b9b92 commit 7fd589c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

hash.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4158,13 +4158,15 @@ assoc_i(VALUE key, VALUE val, VALUE arg)
41584158

41594159
/*
41604160
* call-seq:
4161-
* hash.assoc(key) -> new_array or nil
4161+
* assoc(key) -> entry or nil
4162+
*
4163+
* If the given +key+ is found, returns its entry as a 2-element array
4164+
* containing that key and its value:
41624165
*
4163-
* If the given +key+ is found, returns a 2-element Array containing that key and its value:
41644166
* h = {foo: 0, bar: 1, baz: 2}
41654167
* h.assoc(:bar) # => [:bar, 1]
41664168
*
4167-
* Returns +nil+ if key +key+ is not found.
4169+
* Returns +nil+ if the key is not found.
41684170
*/
41694171

41704172
static VALUE

0 commit comments

Comments
 (0)