Class: ThemeCheck::Tags::Layout

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

Defined Under Namespace

Classes: ParseTreeVisitor

Constant Summary collapse

SYNTAX =
/(?<layout>#{Liquid::QuotedFragment})/
NO_LAYOUT_KEYS =
%w(false nil none).freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, markup, tokens) ⇒ Layout

Returns a new instance of Layout.

Raises:

  • (Liquid::SyntaxError)


106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/theme_check/tags.rb', line 106

def initialize(tag_name, markup, tokens)
  super
  match = markup.match(SYNTAX)
  raise(
    Liquid::SyntaxError,
    "in 'layout' - Valid syntax: layout (none|[layout_name])",
  ) unless match
  layout_markup = match[:layout]
  @layout_expr = if NO_LAYOUT_KEYS.include?(layout_markup.downcase)
    false
  else
    parse_expression(layout_markup)
  end
end

Instance Attribute Details

#layout_exprObject (readonly)

Returns the value of attribute layout_expr.



104
105
106
# File 'lib/theme_check/tags.rb', line 104

def layout_expr
  @layout_expr
end