Skip to content

Instantly share code, notes, and snippets.

@bitwalker
Forked from johnfoconnor/.conf
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bitwalker/b5656fae730ad7990c62 to your computer and use it in GitHub Desktop.
Save bitwalker/b5656fae730ad7990c62 to your computer and use it in GitHub Desktop.
my_app.complex_list.buzz.type = person
my_app.complex_list.buzz.age = 25
my_app.complex_list.fido.type = dog
my_app.complex_list.fido.age = 5
[mappings: [
"my_app.complex_list.*": [
to: "my_app.complex_list",
datatype: [complex: {"my_app.complex_list.*.type", "my_app.complex_list.*.age"}],
default: []
]
"my_app.complex_list.*.type" [
to: "my_app.complex_list",
datatype: :atom,
default: :undefined
],
"my_app.complex_list.*.age" [
to: "my_app.complex_list",
datatype: :integer,
default: 0
]]
translations: [
"my_app.complex_list.*": fn
_, {name, {type, age}}, nil -> [[name: name, type: type, age: age]]
_, {name, {type, age}}, acc -> [[name: name, type: type, age: age] | acc]
]]
[{my_app,
complex_list, [
[{name, buzz},
{type, person},
{age, 25],
[{name, fido},
{type, dog},
{age, 5}]
]}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment