opal/browser/storage.rb
def replace(new)
    if String === new
      @data.replace(JSON.parse(new))
    else
      @data.replace(new)
    end
  end
def replace(new)
    if String === new
      @data.replace(JSON.parse(new))
    else
      @data.replace(new)
    end
  end
Replace the current storage with the given one.

 @param new [Hash, String] if new is a {String} it will be parsed as JSON