Class: ThemeCheck::Tags::Render
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- ThemeCheck::Tags::Render
- Defined in:
- lib/theme_check/tags.rb
Defined Under Namespace
Classes: ParseTreeVisitor
Constant Summary collapse
- SYNTAX =
/((?:#{Liquid::QuotedString}|#{Liquid::VariableSegment})+)(\s+(with|#{Liquid::Render::FOR})\s+(#{Liquid::QuotedFragment}+))?(\s+(?:as)\s+(#{Liquid::VariableSegment}+))?/o
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#template_name_expr ⇒ Object
readonly
Returns the value of attribute template_name_expr.
Instance Method Summary collapse
-
#initialize(tag_name, markup, options) ⇒ Render
constructor
A new instance of Render.
Constructor Details
#initialize(tag_name, markup, options) ⇒ Render
Returns a new instance of Render.
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/theme_check/tags.rb', line 135 def initialize(tag_name, markup, ) super raise SyntaxError, [:locale].t("errors.syntax.render") unless markup =~ SYNTAX template_name = Regexp.last_match(1) with_or_for = Regexp.last_match(3) variable_name = Regexp.last_match(4) @alias_name = Regexp.last_match(6) @variable_name_expr = variable_name ? parse_expression(variable_name) : nil @template_name_expr = parse_expression(template_name) @for = (with_or_for == Liquid::Render::FOR) @attributes = {} markup.scan(Liquid::TagAttributes) do |key, value| @attributes[key] = parse_expression(value) end end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
133 134 135 |
# File 'lib/theme_check/tags.rb', line 133 def attributes @attributes end |
#template_name_expr ⇒ Object (readonly)
Returns the value of attribute template_name_expr.
133 134 135 |
# File 'lib/theme_check/tags.rb', line 133 def template_name_expr @template_name_expr end |