Sha256: d1d2f3b58f63ad3e5dc59c43959eb3b31e97a21ec1e4ea76fc29dab2dd187965
Contents?: true
Size: 324 Bytes
Versions: 11
Compression:
Stored size: 324 Bytes
Contents
class Hash # Returns a hash that only contains keys that are passed in selected_keys. This is different # from Hash#select, since that method returns an array of arrays. def only(*selected_keys) cpy = self.dup keys.each { |key| cpy.delete(key) unless selected_keys.map(&:to_s).include?(key) } cpy end end
Version data entries
11 entries across 11 versions & 1 rubygems