instance method
except
Ruby on Rails 7.0.10
Since v6.0.6Signature
except(*keys)
Returns a hash with indifferent access that includes everything except given keys.
hash = { a: "x", b: "y", c: 10 }.with_indifferent_access hash.except(:a, "b") # => {c: 10}.with_indifferent_access hash # => { a: "x", b: "y", c: 10 }.with_indifferent_access
Parameters
-
keysrest
Source
# File activesupport/lib/active_support/hash_with_indifferent_access.rb, line 303
def except(*keys)
slice(*self.keys - keys.map { |key| convert_key(key) })
end
Defined in activesupport/lib/active_support/hash_with_indifferent_access.rb line 303
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::HashWithIndifferentAccess