Dumping Array of Tables containing Subtables wrong?
Closed this issue · 1 comments
AxelAtS commented
This does not work, if I'm not mistaken:
hsh = {
'a' => [
{
'c' => {'d' => 'e'}
},
{
'c' => {'d' => 'e'}
}
]
}
puts toml = TOML.dump( hsh)
Returns:
[a.c]
d = "e"
[a.c]
d = "e"
This is wrong, AFAIK.
This works:
hsh = {
'a' => [
{
'c' => 'd'
},
{
'c' => 'd'
}
]
}
puts toml = TOML.dump( hsh)
Returns:
[[a]]
c = "d"
[[a]]
c = "d"
sadiqhabib commented
For anyone who whats to parse first example of @AxelAtS can write it like
hsh = {
'a' => [
{'c' => [{'d' => 'e'}, {'d' => 'e'}]}
]
}
puts TomlRB.dump(hsh)
Will give expected result
[[a]]
[[a.c]]
d = "e"
[[a.c]]
d = "e"