invidious-experimenting/src/invidious/helpers/macros.cr
2018-08-15 20:31:47 -05:00

19 lines
446 B
Crystal

macro add_mapping(mapping)
def initialize({{*mapping.keys.map { |id| "@#{id}".id }}})
end
def to_a
return [{{*mapping.keys.map { |id| "@#{id}".id }}}]
end
DB.mapping({{mapping}})
end
macro templated(filename, template = "template")
render "src/invidious/views/#{{{filename}}}.ecr", "src/invidious/views/#{{{template}}}.ecr"
end
macro rendered(filename)
render "src/invidious/views/#{{{filename}}}.ecr"
end