Class: TomlRB::InlineTable
- Inherits:
-
Object
- Object
- TomlRB::InlineTable
- Defined in:
- lib/toml-rb/inline_table.rb
Instance Method Summary collapse
- #accept_visitor(keyvalue) ⇒ Object
-
#initialize(keyvalue_pairs) ⇒ InlineTable
constructor
A new instance of InlineTable.
- #value(symbolize_keys = false) ⇒ Object
Constructor Details
#initialize(keyvalue_pairs) ⇒ InlineTable
Returns a new instance of InlineTable.
3 4 5 |
# File 'lib/toml-rb/inline_table.rb', line 3 def initialize(keyvalue_pairs) @pairs = keyvalue_pairs end |
Instance Method Details
#accept_visitor(keyvalue) ⇒ Object
7 8 9 |
# File 'lib/toml-rb/inline_table.rb', line 7 def accept_visitor(keyvalue) value keyvalue.symbolize_keys end |
#value(symbolize_keys = false) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/toml-rb/inline_table.rb', line 11 def value(symbolize_keys = false) result = {} @pairs.each do |kv| update = kv.assign({}, [], symbolize_keys) result.merge!(update) { |key, _, _| fail ValueOverwriteError.new(key) } end result end |