Skip to content

Commit a46997a

Browse files
BurdetteLamarpeterzhu2118
authored andcommitted
[DOC] Tweaks for Hash#except
1 parent 188b337 commit a46997a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

hash.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2665,13 +2665,16 @@ rb_hash_slice(int argc, VALUE *argv, VALUE hash)
26652665

26662666
/*
26672667
* call-seq:
2668-
* hsh.except(*keys) -> a_hash
2668+
* except(*keys) -> new_hash
26692669
*
2670-
* Returns a new +Hash+ excluding entries for the given +keys+:
2671-
* h = { a: 100, b: 200, c: 300 }
2672-
* h.except(:a) #=> {b: 200, c: 300}
2670+
* Returns a copy of +self+ that excludes entries for the given +keys+;
2671+
* any +keys+ that are not found are ignored:
26732672
*
2674-
* Any given +keys+ that are not found are ignored.
2673+
* h = {foo:0, bar: 1, baz: 2} # => {:foo=>0, :bar=>1, :baz=>2}
2674+
* h.except(:baz, :foo) # => {:bar=>1}
2675+
* h.except(:bar, :nosuch) # => {:foo=>0, :baz=>2}
2676+
*
2677+
* Related: see {Methods for Deleting}[rdoc-ref:Hash@Methods+for+Deleting].
26752678
*/
26762679

26772680
static VALUE

0 commit comments

Comments
 (0)