diff options
| author | Burdette Lamar <BurdetteLamar@Yahoo.com> | 2025-03-11 14:18:47 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-11 15:18:47 -0400 |
| commit | a5f29213dcd3bd3da896c34505d487569c9ad339 (patch) | |
| tree | 22692efbe5028078364c9756d2b8470c173f5039 /hash.c | |
| parent | 51e2ff1ef777f82b0898f30b636a29b92e63a2e1 (diff) | |
[DOC] Tweaks for Hash#select (#12903)
Notes
Notes:
Merged-By: peterzhu2118 <peter@peterzhu.ca>
Diffstat (limited to 'hash.c')
| -rw-r--r-- | hash.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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 # => #<Enumerator: {foo: 0, bar: 1, baz: 2}: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 |
