From a5f29213dcd3bd3da896c34505d487569c9ad339 Mon Sep 17 00:00:00 2001 From: Burdette Lamar Date: Tue, 11 Mar 2025 14:18:47 -0500 Subject: [DOC] Tweaks for Hash#select (#12903) --- hash.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hash.c b/hash.c index 242e68756e..74951d1081 100644 --- a/hash.c +++ b/hash.c @@ -2779,14 +2779,15 @@ keep_if_i(VALUE key, VALUE value, VALUE hash) * select {|key, value| ... } -> new_hash * select -> new_enumerator * - * Returns a new +Hash+ object whose entries are those for which the block returns a truthy value: + * With a block given, calls the block with each entry's key and value; + * returns a new hash 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 a new Enumerator if no block given: - * h = {foo: 0, bar: 1, baz: 2} - * e = h.select # => # - * e.each {|key, value| value < 2 } # => {foo: 0, bar: 1} + * With no block given, returns a new Enumerator. + * + * Related: see {Methods for Deleting}[rdoc-ref:Hash@Methods+for+Deleting]. */ static VALUE -- cgit v1.2.3