2019-04-03 16:35:58 +00:00
|
|
|
macro db_mapping(mapping)
|
2019-05-30 23:31:22 +00:00
|
|
|
def initialize({{*mapping.keys.map { |id| "@#{id}".id }}})
|
|
|
|
end
|
2018-08-04 20:30:44 +00:00
|
|
|
|
2019-05-30 23:31:22 +00:00
|
|
|
def to_a
|
|
|
|
return [ {{*mapping.keys.map { |id| "@#{id}".id }}} ]
|
|
|
|
end
|
2018-08-04 20:30:44 +00:00
|
|
|
|
2019-05-30 23:31:22 +00:00
|
|
|
def self.to_type_tuple
|
|
|
|
return { {{*mapping.keys.map { |id| "#{id}" }}} }
|
|
|
|
end
|
2019-04-10 21:23:37 +00:00
|
|
|
|
2019-05-30 23:31:22 +00:00
|
|
|
DB.mapping( {{mapping}} )
|
2018-08-04 20:30:44 +00:00
|
|
|
end
|
|
|
|
|
2019-03-28 18:43:40 +00:00
|
|
|
macro json_mapping(mapping)
|
2019-05-30 23:31:22 +00:00
|
|
|
def initialize({{*mapping.keys.map { |id| "@#{id}".id }}})
|
|
|
|
end
|
2019-03-28 18:43:40 +00:00
|
|
|
|
2019-05-30 23:31:22 +00:00
|
|
|
def to_a
|
|
|
|
return [ {{*mapping.keys.map { |id| "@#{id}".id }}} ]
|
|
|
|
end
|
2019-03-28 18:43:40 +00:00
|
|
|
|
2019-05-30 23:31:22 +00:00
|
|
|
patched_json_mapping( {{mapping}} )
|
|
|
|
YAML.mapping( {{mapping}} )
|
2019-04-03 16:35:58 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
macro yaml_mapping(mapping)
|
2019-05-30 23:31:22 +00:00
|
|
|
def initialize({{*mapping.keys.map { |id| "@#{id}".id }}})
|
|
|
|
end
|
2019-04-03 16:35:58 +00:00
|
|
|
|
2019-05-30 23:31:22 +00:00
|
|
|
def to_a
|
|
|
|
return [ {{*mapping.keys.map { |id| "@#{id}".id }}} ]
|
|
|
|
end
|
2019-04-03 16:35:58 +00:00
|
|
|
|
2019-05-30 23:31:22 +00:00
|
|
|
def to_tuple
|
|
|
|
return { {{*mapping.keys.map { |id| "@#{id}".id }}} }
|
|
|
|
end
|
2019-04-03 16:35:58 +00:00
|
|
|
|
2019-05-30 23:31:22 +00:00
|
|
|
YAML.mapping({{mapping}})
|
2019-03-28 18:43:40 +00:00
|
|
|
end
|
|
|
|
|
2018-08-16 01:31:47 +00:00
|
|
|
macro templated(filename, template = "template")
|
2019-05-30 23:31:22 +00:00
|
|
|
render "src/invidious/views/#{{{filename}}}.ecr", "src/invidious/views/#{{{template}}}.ecr"
|
2018-08-04 20:30:44 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
macro rendered(filename)
|
2019-05-30 23:31:22 +00:00
|
|
|
render "src/invidious/views/#{{{filename}}}.ecr"
|
2018-08-04 20:30:44 +00:00
|
|
|
end
|