2019-04-03 11:35:58 -05:00
|
|
|
macro db_mapping(mapping)
|
2018-08-04 15:30:44 -05:00
|
|
|
def initialize({{*mapping.keys.map { |id| "@#{id}".id }}})
|
|
|
|
end
|
|
|
|
|
|
|
|
def to_a
|
|
|
|
return [{{*mapping.keys.map { |id| "@#{id}".id }}}]
|
|
|
|
end
|
|
|
|
|
|
|
|
DB.mapping({{mapping}})
|
|
|
|
end
|
|
|
|
|
2019-03-28 13:43:40 -05:00
|
|
|
macro json_mapping(mapping)
|
|
|
|
def initialize({{*mapping.keys.map { |id| "@#{id}".id }}})
|
|
|
|
end
|
|
|
|
|
|
|
|
def to_a
|
|
|
|
return [{{*mapping.keys.map { |id| "@#{id}".id }}}]
|
|
|
|
end
|
|
|
|
|
|
|
|
JSON.mapping({{mapping}})
|
2019-04-03 11:35:58 -05:00
|
|
|
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}})
|
2019-03-28 13:43:40 -05:00
|
|
|
end
|
|
|
|
|
2018-08-15 20:31:47 -05:00
|
|
|
macro templated(filename, template = "template")
|
2018-08-11 10:52:13 -05:00
|
|
|
render "src/invidious/views/#{{{filename}}}.ecr", "src/invidious/views/#{{{template}}}.ecr"
|
2018-08-04 15:30:44 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
macro rendered(filename)
|
|
|
|
render "src/invidious/views/#{{{filename}}}.ecr"
|
|
|
|
end
|