class ActiveSupport::HashWithIndifferentAccess

def replace(other_hash)

h.replace({ "c" => 300, "d" => 400 }) # => {"c"=>300, "d"=>400}
h = { "a" => 100, "b" => 200 }

Replaces the contents of this hash with other_hash.
def replace(other_hash)
  super(self.class.new(other_hash))
end