From 1b6fddf4db9405d44db8b30493a943d766ddc1cb Mon Sep 17 00:00:00 2001 From: BurdetteLamar Date: Wed, 26 Feb 2025 10:22:05 -0600 Subject: [PATCH] [DOC] Tweaks for Hash#keep_if --- hash.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hash.c b/hash.c index a05f9c457e..0d5f1554a1 100644 --- a/hash.c +++ b/hash.c @@ -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; + * With a block given, calls the block for each key-value pair; * retains the entry if the block returns a truthy value; - * otherwise deletes the entry; returns +self+. + * 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 # => # - * e.each { |key, value| key.start_with?('b') } # => {bar: 1, baz: 2} + * With no block given, returns a new Enumerator. + * + * Related: see {Methods for Deleting}[rdoc-ref:Hash@Methods+for+Deleting]. */ static VALUE