lib/tomlrb/handler.rb in tomlrb-2.0.0 vs lib/tomlrb/handler.rb in tomlrb-2.0.1
- old
+ new
@@ -123,10 +123,11 @@
else
current = current << [key, :table, declared, is_array_of_tables]
end
end
+ current.clear_children if is_array_of_tables
current
end
def find_or_create_first_table_key(current, key, declared, is_array_of_tables)
existed = current[key]
@@ -187,9 +188,13 @@
validate_already_declared_as_non_array_table(type, is_array_of_tables, declared, existed)
validate_path_already_created_as_different_type(type, declared, existed)
validate_path_already_declared_as_different_type(type, declared, existed)
validate_already_declared_as_same_key(declared, existed)
@children[key] = existed || self.class.new(key, type, declared)
+ end
+
+ def clear_children
+ @children.clear
end
private
def validate_already_declared_as_different_key(type, declared, existed)