Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/philtre/core_extensions.rb
Instance Method Summary collapse
-
#slice(*other_keys) ⇒ Object
return a hash containing only the specified keys.
Instance Method Details
#slice(*other_keys) ⇒ Object
return a hash containing only the specified keys
24 25 26 27 28 29 |
# File 'lib/philtre/core_extensions.rb', line 24 def slice( *other_keys ) other_keys.inject(Hash.new) do |hash, key| hash[key] = self[key] if has_key?( key ) hash end end |