Method: Hash#slice
- Defined in:
- lib/nutella/core_ext/hash.rb
#slice(*keys) ⇒ Hash Also known as: grab
Grab the given keys out of a hash.
20 21 22 |
# File 'lib/nutella/core_ext/hash.rb', line 20 def slice(*keys) select { |k, v| keys.include? k } end |