Module: Cape::CoreExt::Hash
- Defined in:
- lib/cape/core_ext/hash.rb
Overview
Adds methods missing from Ruby’s Hash core class.
Instance Method Summary collapse
-
#slice(*keys) ⇒ Hash
Returns a copy of the Hash containing values only for the specified keys.
Instance Method Details
#slice(*keys) ⇒ Hash
Returns a copy of the Hash containing values only for the specified keys.
14 15 16 |
# File 'lib/cape/core_ext/hash.rb', line 14 def slice(*keys) ::Hash[select { |key, value| keys.include? key }] end |