Method: Liquid::For#initialize

Defined in:
lib/liquid/standardtags.rb

#initialize(markup, tokens) ⇒ For

Returns a new instance of For.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/liquid/standardtags.rb', line 93

def initialize(markup, tokens)
  super

  if markup =~ Syntax
    @variable_name = $1
    @collection_name = $2
    @name = "#{$1}-#{$2}"
    @attributes = {}
    markup.scan(TagAttributes) do |key, value|
      @attributes[key] = value
    end        
  else
    raise SyntaxError.new("Syntax Error in 'for loop' - Valid syntax: for [item] in [collection]")
  end
end