invidious-experimenting/src/invidious/helpers/macros.cr

19 lines
446 B
Crystal
Raw Normal View History

2018-08-05 02:00:44 +05:30
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
2018-08-16 07:01:47 +05:30
macro templated(filename, template = "template")
render "src/invidious/views/#{{{filename}}}.ecr", "src/invidious/views/#{{{template}}}.ecr"
2018-08-05 02:00:44 +05:30
end
macro rendered(filename)
render "src/invidious/views/#{{{filename}}}.ecr"
end