diff options
| author | BurdetteLamar <burdettelamar@yahoo.com> | 2025-02-18 08:51:37 -0600 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2025-02-18 10:04:58 -0500 |
| commit | eafcdc153560fd391dabd60705cb88e3f72d7b47 (patch) | |
| tree | 0b22f7bc7ab8269fd72553ecd0db2de7bb624989 | |
| parent | e9ba334fd1655c09ad30030773f43e3b710a4a91 (diff) | |
[DOC] Tweaks for Hash#each_key
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12773
| -rw-r--r-- | hash.c | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -3078,23 +3078,19 @@ each_key_i(VALUE key, VALUE value, VALUE _) * each_key {|key| ... } -> self * each_key -> new_enumerator * - * Calls the given block with each key; returns +self+: + * With a block given, calls the block with each key; returns +self+: + * * h = {foo: 0, bar: 1, baz: 2} * h.each_key {|key| puts key } # => {foo: 0, bar: 1, baz: 2} - * Output: - * foo - * bar - * baz * - * Returns a new Enumerator if no block given: - * h = {foo: 0, bar: 1, baz: 2} - * e = h.each_key # => #<Enumerator: {foo: 0, bar: 1, baz: 2}:each_key> - * h1 = e.each {|key| puts key } - * h1 # => {foo: 0, bar: 1, baz: 2} * Output: * foo * bar * baz + * + * With no block given, returns a new Enumerator. + * + * Related: see {Methods for Iterating}[rdoc-ref:Hash@Methods+for+Iterating]. */ static VALUE rb_hash_each_key(VALUE hash) |
