Class: Hash

Inherits:
Object show all
Defined in:
lib/core_ext/hash.rb

Instance Method Summary collapse

Instance Method Details

#slice(*keys) ⇒ Object

File activesupport/lib/active_support/core_ext/hash/slice.rb, line 21



5
6
7
8
# File 'lib/core_ext/hash.rb', line 5

def slice(*keys)
  keys.map! { |key| convert_key(key) } if respond_to?(:convert_key, true)
  keys.each_with_object(self.class.new) { |k, hash| hash[k] = self[k] if key?(k) }
end