Class: Riml::Compiler::NodesVisitor

Inherits:
Visitor
  • Object
show all
Defined in:
lib/riml/compiler.rb

Instance Method Summary collapse

Methods inherited from Visitor

#initialize, #visit

Constructor Details

This class inherits a constructor from Riml::Compiler::Visitor

Instance Method Details

#compile(nodes) ⇒ Object



150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/riml/compiler.rb', line 150

def compile(nodes)
  nodes.each_with_index do |node, i|
    visitor = visitor_for_node(node)
    node.parent_node = nodes
    next_node = nodes.nodes[i+1]
    if ElseNode === next_node
      node.force_newline = true
    end
    node.accept(visitor)
  end
  nodes.compiled_output
end