Module: HashSlice
- Defined in:
- lib/vagrant-boxen/hash_slice.rb
Instance Method Summary collapse
-
#slice(*keys) ⇒ Object
From ActiveSupport.
Instance Method Details
#slice(*keys) ⇒ Object
From ActiveSupport
3 4 5 6 7 8 |
# File 'lib/vagrant-boxen/hash_slice.rb', line 3 def slice(*keys) keys = keys.map! { |key| convert_key(key) } if respond_to?(:convert_key) hash = self.class.new keys.each { |k| hash[k] = self[k] if has_key?(k) } hash end |