class Hash
Public Instance Methods
only(*keys)
click to toggle source
# File lib/core-ext/hash.rb, line 2 def only(*keys) inject( {} ) do |new_hash, (key, value)| new_hash[key] = value if keys.include?(key) new_hash end end