Skip to content

Commit 1b6fddf

Browse files
BurdetteLamarpeterzhu2118
authored andcommitted
[DOC] Tweaks for Hash#keep_if
1 parent 04e46bd commit 1b6fddf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

hash.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2836,16 +2836,16 @@ rb_hash_select_bang(VALUE hash)
28362836
* keep_if {|key, value| ... } -> self
28372837
* keep_if -> new_enumerator
28382838
*
2839-
* Calls the block for each key-value pair;
2839+
* With a block given, calls the block for each key-value pair;
28402840
* retains the entry if the block returns a truthy value;
2841-
* otherwise deletes the entry; returns +self+.
2841+
* otherwise deletes the entry; returns +self+:
2842+
*
28422843
* h = {foo: 0, bar: 1, baz: 2}
28432844
* h.keep_if { |key, value| key.start_with?('b') } # => {bar: 1, baz: 2}
28442845
*
2845-
* Returns a new Enumerator if no block given:
2846-
* h = {foo: 0, bar: 1, baz: 2}
2847-
* e = h.keep_if # => #<Enumerator: {foo: 0, bar: 1, baz: 2}:keep_if>
2848-
* e.each { |key, value| key.start_with?('b') } # => {bar: 1, baz: 2}
2846+
* With no block given, returns a new Enumerator.
2847+
*
2848+
* Related: see {Methods for Deleting}[rdoc-ref:Hash@Methods+for+Deleting].
28492849
*/
28502850

28512851
static VALUE

0 commit comments

Comments
 (0)