Method: Atatus::CentralConfig#assign

Defined in:
lib/atatus/central_config.rb

#assign(update) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/atatus/central_config.rb', line 93

def assign(update)
  # For each updated option, store the original value,
  # unless already stored
  update.each_key do |key|
    @modified_options[key] ||= config.get(key.to_sym)&.value
  end

  # If the new update doesn't set a previously modified option,
  # revert it to the original
  @modified_options.each_key do |key|
    next if update.key?(key)
    update[key] = @modified_options.delete(key)
  end

  @config.replace_options(update)
end