Method: Hocon::ConfigObject#with_value

Defined in:
lib/hocon/config_object.rb

#with_value(key, value) ⇒ Object

Returns a ConfigObject based on this one, but with the given key set to the given value. Does not modify this instance (since it’s immutable). If the key already has a value, that value is replaced. To remove a value, use ConfigObject#withoutKey(String).

Parameters:

  • key

    key to add

  • value

    value at the new key

Returns:

  • the new instance with the new map entry

Raises:



139
140
141
# File 'lib/hocon/config_object.rb', line 139

def with_value(key, value)
  raise Hocon::ConfigError::ConfigBugOrBrokenError, "subclasses of ConfigObject should provide their own implementation of `with_value` (#{self.class})"
end