Sha256: f4379d084dea494b0730022897d43b20e229356fcc2d8eddfb0c344463a28744
Contents?: true
Size: 440 Bytes
Versions: 6
Compression:
Stored size: 440 Bytes
Contents
class Hash # Returns a new hash less the given keys. def except(*less_keys) slice(*keys - less_keys) end # Replaces hash with new hash less the given keys. # This returns the hash of keys removed. # # h = {:a=>1, :b=>2, :c=>3} # h.except!(:a) #=> {:a=>1} # h #=> {:b=>2,:c=>3} # def except!(*less_keys) removed = slice(*less_keys) replace(except(*less_keys)) removed end end
Version data entries
6 entries across 6 versions & 1 rubygems