summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorBurdette Lamar <[email protected]>2025-03-11 14:19:38 -0500
committer<[email protected]>2025-03-11 15:19:38 -0400
commitb52f78952039a6b50ceaee4626ef9f0fb59eab6b ()
tree6c7c9a905b094f54f94c09cc59dbe4a77f2f67e1 /hash.c
parenta5f29213dcd3bd3da896c34505d487569c9ad339 (diff)
[DOC] Tweaks for Hash#select! (#12904)
Notes: Merged-By: peterzhu2118 <[email protected]>
-rw-r--r--hash.c17
1 files changed, 10 insertions, 7 deletions
@@ -2809,16 +2809,19 @@ rb_hash_select(VALUE hash)
* select! {|key, value| ... } -> self or nil
* select! -> new_enumerator
*
- * Returns +self+, whose entries are those for which the block returns a truthy value:
- * h = {foo: 0, bar: 1, baz: 2}
- * h.select! {|key, value| value < 2 } => {foo: 0, bar: 1}
*
- * Returns +nil+ if no entries were removed.
*
- * Returns a new Enumerator if no block given:
* h = {foo: 0, bar: 1, baz: 2}
- * e = h.select! # => #<Enumerator: {foo: 0, bar: 1, baz: 2}:select!>
- * e.each { |key, value| value < 2 } # => {foo: 0, bar: 1}
*/
static VALUE