Method: Hash#except!

Defined in:
activesupport/lib/active_support/core_ext/hash/except.rb

#except!(*keys) ⇒ Object

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 }


8
9
10
11
# File 'activesupport/lib/active_support/core_ext/hash/except.rb', line 8

def except!(*keys)
  keys.each { |key| delete(key) }
  self
end