Skip to content

Commit eafcdc1

Browse files
BurdetteLamarpeterzhu2118
authored andcommitted
[DOC] Tweaks for Hash#each_key
1 parent e9ba334 commit eafcdc1

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

hash.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3078,23 +3078,19 @@ each_key_i(VALUE key, VALUE value, VALUE _)
30783078
* each_key {|key| ... } -> self
30793079
* each_key -> new_enumerator
30803080
*
3081-
* Calls the given block with each key; returns +self+:
3081+
* With a block given, calls the block with each key; returns +self+:
3082+
*
30823083
* h = {foo: 0, bar: 1, baz: 2}
30833084
* h.each_key {|key| puts key } # => {foo: 0, bar: 1, baz: 2}
3084-
* Output:
3085-
* foo
3086-
* bar
3087-
* baz
30883085
*
3089-
* Returns a new Enumerator if no block given:
3090-
* h = {foo: 0, bar: 1, baz: 2}
3091-
* e = h.each_key # => #<Enumerator: {foo: 0, bar: 1, baz: 2}:each_key>
3092-
* h1 = e.each {|key| puts key }
3093-
* h1 # => {foo: 0, bar: 1, baz: 2}
30943086
* Output:
30953087
* foo
30963088
* bar
30973089
* baz
3090+
*
3091+
* With no block given, returns a new Enumerator.
3092+
*
3093+
* Related: see {Methods for Iterating}[rdoc-ref:Hash@Methods+for+Iterating].
30983094
*/
30993095
static VALUE
31003096
rb_hash_each_key(VALUE hash)

0 commit comments

Comments
 (0)