Sha256: 9d03d7ff7cd92a6141ffced07bcfa8e2bf0a11179a53655de2c1e10863e61f55
Contents?: true
Size: 507 Bytes
Versions: 13
Compression:
Stored size: 507 Bytes
Contents
class Hash # Returns a new hash less the given keys. def except(*less_keys) slice(*keys - less_keys) end unless defined?(::ActiveSupport) # 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 end
Version data entries
13 entries across 13 versions & 2 rubygems