method
extract!
v3.2.13 -
Show latest stable
- Class:
Hash
extract!(*keys)public
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}
1Note
without a bang
We can use hash#slice[http://api.rubyonrails.org/classes/Hash.html#method-i-slice] if we want an Hash#extract (without bang) like behavior.