2020-03-11 09:30:45 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
class ThemeModifierHelper
|
|
|
|
def initialize(request: nil, theme_ids: nil)
|
2021-06-17 22:16:26 -04:00
|
|
|
@theme_ids = theme_ids || Theme.transform_ids(request&.env&.[](:resolved_theme_id))
|
2020-03-11 09:30:45 -04:00
|
|
|
end
|
|
|
|
|
2020-03-12 12:35:28 -04:00
|
|
|
ThemeModifierSet.modifiers.keys.each do |modifier|
|
2020-03-11 09:30:45 -04:00
|
|
|
define_method(modifier) do
|
|
|
|
Theme.lookup_modifier(@theme_ids, modifier)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|