Sha256: 827446fdf633a7790417574c8a949c6c67f402bad3783634fb58feecee6bdcb7

Contents?: true

Size: 620 Bytes

Versions: 19

Compression:

Stored size: 620 Bytes

Contents

# frozen_string_literal: true
require 'yaml'

module ThemeCheck
  module ShopifyLiquid
    module Tag
      extend self

      def labels
        @tags ||= YAML.load(File.read("#{__dir__}/../../../data/shopify_liquid/tags.yml"))
          .to_set
      end

      def tag_regex(tag)
        return unless labels.include?(tag)
        @tag_regexes ||= {}
        @tag_regexes[tag] ||= /\A#{Liquid::TagStart}-?\s*#{tag}/m
      end

      def liquid_tag_regex(tag)
        return unless labels.include?(tag)
        @tag_liquid_regexes ||= {}
        @tag_liquid_regexes[tag] ||= /^\s*#{tag}/m
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
theme-check-1.7.0 lib/theme_check/shopify_liquid/tag.rb
theme-check-1.6.2 lib/theme_check/shopify_liquid/tag.rb
theme-check-1.6.1 lib/theme_check/shopify_liquid/tag.rb
theme-check-1.6.0 lib/theme_check/shopify_liquid/tag.rb
theme-check-1.5.2 lib/theme_check/shopify_liquid/tag.rb
theme-check-1.5.1 lib/theme_check/shopify_liquid/tag.rb
theme-check-1.5.0 lib/theme_check/shopify_liquid/tag.rb
theme-check-1.4.0 lib/theme_check/shopify_liquid/tag.rb
theme-check-1.3.0 lib/theme_check/shopify_liquid/tag.rb
theme-check-1.2.0 lib/theme_check/shopify_liquid/tag.rb
theme-check-1.1.0 lib/theme_check/shopify_liquid/tag.rb
theme-check-1.0.0 lib/theme_check/shopify_liquid/tag.rb
theme-check-0.10.2 lib/theme_check/shopify_liquid/tag.rb
theme-check-0.10.1 lib/theme_check/shopify_liquid/tag.rb
theme-check-0.10.0 lib/theme_check/shopify_liquid/tag.rb
theme-check-0.9.1 lib/theme_check/shopify_liquid/tag.rb
theme-check-0.9.0 lib/theme_check/shopify_liquid/tag.rb
theme-check-0.8.3 lib/theme_check/shopify_liquid/tag.rb
theme-check-0.8.2 lib/theme_check/shopify_liquid/tag.rb