instance method
extract!
Ruby on Rails 3.1.12
Since v3.0.20Signature
extract!(*keys)
Removes and returns the key/value pairs matching the given keys.
{:a => 1, :b => 2, :c => 3, :d => 4}.extract!(:a, :b) # => {:a => 1, :b => 2}
Parameters
-
keysrest
Source
# File activesupport/lib/active_support/core_ext/hash/slice.rb, line 35
def extract!(*keys)
result = {}
keys.each {|key| result[key] = delete(key) }
result
end
Defined in activesupport/lib/active_support/core_ext/hash/slice.rb line 35
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Hash