Module: HashValuesAt

Included in:
Hash
Defined in:
lib/core_ext/hash.rb

Instance Method Summary collapse

Instance Method Details

#hash_at(*keys) ⇒ Object

Works similiar to the values_at method but return instead of just values an appropriate hash



7
8
9
10
11
# File 'lib/core_ext/hash.rb', line 7

def hash_at(*keys)
  hash = Hash.new
  keys.zip(self.values_at(*keys)).each {|k, v| hash[k] = v}
  hash
end