Module: ThemeCheck::ShopifyLiquid::Tag
Constant Summary collapse
- LABELS_NOT_IN_SOURCE_INDEX =
["elsif", "ifchanged", { "schema" => "endschema" }, "when"]
Instance Method Summary collapse
Instance Method Details
#end_labels ⇒ Object
17 18 19 20 21 |
# File 'lib/theme_check/shopify_liquid/tag.rb', line 17 def end_labels @end_labels ||= .select { |x| x.is_a?(Hash) } .map { |x| x.values[0] } end |
#labels ⇒ Object
11 12 13 14 15 |
# File 'lib/theme_check/shopify_liquid/tag.rb', line 11 def labels @labels ||= .map { |x| to_label(x) } .to_set end |
#liquid_tag_regex(tag) ⇒ Object
29 30 31 32 33 |
# File 'lib/theme_check/shopify_liquid/tag.rb', line 29 def liquid_tag_regex(tag) return unless labels.include?(tag) @tag_liquid_regexes ||= {} @tag_liquid_regexes[tag] ||= /^\s*#{tag}/m end |
#tag_regex(tag) ⇒ Object
23 24 25 26 27 |
# File 'lib/theme_check/shopify_liquid/tag.rb', line 23 def tag_regex(tag) return unless labels.include?(tag) @tag_regexes ||= {} @tag_regexes[tag] ||= /\A#{Liquid::TagStart}-?\s*#{tag}/m end |