Method: Hash#slice!
- Defined in:
- lib/nutella/core_ext/hash.rb
#slice!(*keys) ⇒ Hash Also known as: grab!
Acts on the hash as described in Hash#slice, but modifies the hash in place.
35 36 37 38 |
# File 'lib/nutella/core_ext/hash.rb', line 35 def slice!(*keys) replace((original = self.dup).slice *keys) original.reject { |k, v| keys.include? k } end |