Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/forrst/monkeys/hash.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#subset(*keys) ⇒ Hash
Given a set of keys this method will create a new hash with those keys and their values.
Instance Method Details
#subset(*keys) ⇒ Hash
Given a set of keys this method will create a new hash with those keys and their values.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/forrst/monkeys/hash.rb', line 15 def subset(*keys) new_hash = {} keys.each do |k| if self.key?(k) new_hash[k] = self[k] end end return new_hash end |