class IniParse::Lines::Section
def []=(key, value)
new option to be considered a duplicate, use +add_option+ instead.
If you do not wish to overwrite duplicates, but wish instead for your
# => 'new value'
section['an_option]
section['an_option'] = 'new value'
# => ['duplicate one', 'duplicate two', ...]
section['an_option']
overwrite duplicate options with your new value.
Note that +[]=+ has no knowledge of duplicate options and will happily
Adds a new option to this section, or updates an existing one.
def []=(key, value) line = @lines[key.to_s] opts = {} if line.kind_of?(Array) opts = line.first.options elsif line.respond_to? :options opts = line.options end @lines[key.to_s] = IniParse::Lines::Option.new(key.to_s, value, opts) end