module RedisHash::Mutations

Public Instance Methods

compact!() click to toggle source
# File lib/redis_hash/concerns/mutations.rb, line 8
def compact!
  delete_if { |_, value| value.blank? }
end
invert() click to toggle source
# File lib/redis_hash/concerns/mutations.rb, line 12
def invert
  inversion = to_h.invert
  clear
  inversion.each { |key, value| self[key] = value }
end
replace(other_hash) click to toggle source
# File lib/redis_hash/concerns/mutations.rb, line 18
def replace(other_hash)
  clear and merge!(other_hash)
end