mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #21087 from vngrs/fix_hash_except_doc
Fix the documentation of Hash#except method [ci skip]
This commit is contained in:
commit
351d62e0e8
1 changed files with 9 additions and 8 deletions
|
@ -1,7 +1,8 @@
|
|||
class Hash
|
||||
# Returns a hash that includes everything but the given keys.
|
||||
# Returns a hash that includes everything except given keys.
|
||||
# hash = { a: true, b: false, c: nil }
|
||||
# hash.except(:c) # => { a: true, b: false }
|
||||
# hash.except(:a, :b) # => { c: nil }
|
||||
# hash # => { a: true, b: false, c: nil }
|
||||
#
|
||||
# This is useful for limiting a set of parameters to everything but a few known toggles:
|
||||
|
@ -10,7 +11,7 @@ class Hash
|
|||
dup.except!(*keys)
|
||||
end
|
||||
|
||||
# Replaces the hash without the given keys.
|
||||
# Removes the given keys from hash and returns it.
|
||||
# hash = { a: true, b: false, c: nil }
|
||||
# hash.except!(:c) # => { a: true, b: false }
|
||||
# hash # => { a: true, b: false }
|
||||
|
|
Loading…
Reference in a new issue