class Hash
def except(*keys)
This is useful for limiting a set of parameters to everything but a few known toggles:
hash # => { a: true, b: false, c: nil }
hash.except(:a, :b) # => { c: nil }
hash.except(:c) # => { a: true, b: false }
hash = { a: true, b: false, c: nil }
Returns a hash that includes everything except given keys.
def except(*keys) slice(*self.keys - keys) end unless method_defined?(:except)