self
and its subsection in a Map
of keys => valuesProperties from section are prefixed with their section names with the
dot (.
) notation.
var ini = new IniFile.from_string("""
key=value1
[section]
key=value2
""")
assert ini.flatten.join(", ", ": ") == "key: value1, section.key: value2"
# Flatten `self` and its subsection in a `Map` of keys => values
#
# Properties from section are prefixed with their section names with the
# dot (`.`) notation.
#
# ~~~
# var ini = new IniFile.from_string("""
# key=value1
# [section]
# key=value2
# """)
# assert ini.flatten.join(", ", ": ") == "key: value1, section.key: value2"
# ~~~
fun flatten: Map[String, String] do
var map = new HashMap[String, String]
for key, value in self do
if value == null then continue
map[key] = value
end
for section in sections do
for key, value in section do
if value == null then continue
map["{section.name}.{key}"] = value
end
end
return map
end
lib/ini/ini.nit:272,2--298,4