Class: ThemeCheck::Tags::Sections

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/theme_check/tags.rb

Constant Summary collapse

SYNTAX =
/\A\s*(?<sections_name>#{Liquid::QuotedString})\s*\z/o

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, markup, options) ⇒ Sections

Returns a new instance of Sections.

Raises:

  • (Liquid::SyntaxError)


30
31
32
33
34
35
36
37
38
39
40
# File 'lib/theme_check/tags.rb', line 30

def initialize(tag_name, markup, options)
  super

  match = markup.match(SYNTAX)
  raise(
    Liquid::SyntaxError,
    "Error in tag 'sections' - Valid syntax: sections '[type]'",
  ) unless match
  @sections_name = match[:sections_name].tr(%('"), '')
  @sections_name.chomp!(".liquid") if @sections_name.end_with?(".liquid")
end

Instance Attribute Details

#sections_nameObject (readonly)

Returns the value of attribute sections_name.



28
29
30
# File 'lib/theme_check/tags.rb', line 28

def sections_name
  @sections_name
end