Method: Hash#except!

Defined in:
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 }


18
19
20
21
# File 'lib/active_support/core_ext/hash/except.rb', line 18

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