Add option to configure default user preferences

This commit is contained in:
Omar Roth
2019-04-03 11:35:58 -05:00
parent 1fd7ff5655
commit bd4f5ebcdf
9 changed files with 192 additions and 90 deletions

View File

@@ -1,4 +1,4 @@
macro add_mapping(mapping)
macro db_mapping(mapping)
def initialize({{*mapping.keys.map { |id| "@#{id}".id }}})
end
@@ -18,6 +18,22 @@ macro json_mapping(mapping)
end
JSON.mapping({{mapping}})
YAML.mapping({{mapping}})
end
macro yaml_mapping(mapping)
def initialize({{*mapping.keys.map { |id| "@#{id}".id }}})
end
def to_a
return [{{*mapping.keys.map { |id| "@#{id}".id }}}]
end
def to_tuple
return { {{*mapping.keys.map { |id| "@#{id}".id }}} }
end
YAML.mapping({{mapping}})
end
macro templated(filename, template = "template")