Class: Twig::Node::ForLoop
- Inherits:
-
Node::Base
- Object
- Node::Base
- Twig::Node::ForLoop
- Defined in:
- lib/twig/node/for_loop.rb
Instance Method Summary collapse
- #compile(compiler) ⇒ Object
-
#initialize(lineno) ⇒ ForLoop
constructor
A new instance of ForLoop.
Constructor Details
#initialize(lineno) ⇒ ForLoop
Returns a new instance of ForLoop.
6 7 8 |
# File 'lib/twig/node/for_loop.rb', line 6 def initialize(lineno) super({}, { with_loop: false, if_expr: false, else_expr: false }, lineno) end |
Instance Method Details
#compile(compiler) ⇒ Object
10 11 12 13 14 |
# File 'lib/twig/node/for_loop.rb', line 10 def compile(compiler) if attributes.key?(:else_expr) compiler.write("context[:_iterated] = true\n") end end |