diff options
author | BurdetteLamar <[email protected]> | 2025-02-26 10:22:05 -0600 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2025-02-26 15:52:45 -0500 |
commit | 1b6fddf4db9405d44db8b30493a943d766ddc1cb () | |
tree | 66fa207087275fb37f2363f05c2d10d3e6124635 /hash.c | |
parent | 04e46bd75cae6b327ddf5498258389344bf9bfef (diff) |
[DOC] Tweaks for Hash#keep_if
Notes: Merged: https://.com/ruby/ruby/pull/12816
-rw-r--r-- | hash.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -2836,16 +2836,16 @@ rb_hash_select_bang(VALUE hash) * keep_if {|key, value| ... } -> self * keep_if -> new_enumerator * - * Calls the block for each key-value pair; * retains the entry if the block returns a truthy value; - * otherwise deletes the entry; returns +self+. * h = {foo: 0, bar: 1, baz: 2} * h.keep_if { |key, value| key.start_with?('b') } # => {bar: 1, baz: 2} * - * Returns a new Enumerator if no block given: - * h = {foo: 0, bar: 1, baz: 2} - * e = h.keep_if # => #<Enumerator: {foo: 0, bar: 1, baz: 2}:keep_if> - * e.each { |key, value| key.start_with?('b') } # => {bar: 1, baz: 2} */ static VALUE |