Sha256: a905b92c3273a4648721607951e531709a9d99d46222a8ba0e31740124fc79f2
Contents?: true
Size: 281 Bytes
Versions: 2
Compression:
Stored size: 281 Bytes
Contents
module TopHat module HashOnly # Returns a new hash with only the given keys. def only(*keys) reject {|key, value| !keys.include?(key) } end # Replaces the hash without only the given keys. def only!(*keys) replace(only(*keys)) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
tophat-1.1.0 | lib/tophat/core_extensions.rb |
tophat-1.0.0 | lib/tophat/core_extensions.rb |