Class: TOML::Keyvalue

Inherits:
Object
  • Object
show all
Defined in:
lib/toml/keyvalue.rb

Instance Method Summary collapse

Constructor Details

#initialize(key, value) ⇒ Keyvalue

Returns a new instance of Keyvalue.



5
6
7
# File 'lib/toml/keyvalue.rb', line 5

def initialize(key, value)
  @key, @value = key, value
end

Instance Method Details

#assign(hash, symbolize_keys = false) ⇒ Object



9
10
11
12
13
14
# File 'lib/toml/keyvalue.rb', line 9

def assign(hash, symbolize_keys = false)
  raise ValueOverwriteError if hash[@key]

  key = symbolize_keys ? @key.to_sym : @key
  hash[key] = @value
end