Method: Liquid::Render#initialize

Defined in:
lib/liquid/tags/render.rb

#initialize(tag_name, markup, options) ⇒ Render

Returns a new instance of Render.

Raises:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/liquid/tags/render.rb', line 36

def initialize(tag_name, markup, options)
  super

  raise SyntaxError, options[: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)
  @is_for_loop = (with_or_for == FOR)

  @attributes = {}
  markup.scan(TagAttributes) do |key, value|
    @attributes[key] = parse_expression(value)
  end
end