Class: BuildTool::Cfg::ListVisitor

Inherits:
MJ::VisitorBase show all
Defined in:
lib/build-tool/cfg/visitor.rb

Overview

Base class for all Visitors which need to iterate over their child nodes.

Instance Attribute Summary

Attributes inherited from MJ::VisitorBase

#configuration

Instance Method Summary collapse

Methods inherited from MJ::VisitorBase

#initialize, #visit_Object

Constructor Details

This class inherits a constructor from MJ::VisitorBase

Instance Method Details

#visit(node) ⇒ Object

Visit one node.



21
22
23
# File 'lib/build-tool/cfg/visitor.rb', line 21

def visit( node )
    return self.visit_nodes( node.values )
end

#visit_nodes(nodes) ⇒ Object

Visit all nodes.



26
27
28
29
30
31
32
33
34
# File 'lib/build-tool/cfg/visitor.rb', line 26

def visit_nodes(nodes)
    list = []
    return list if nodes.nil?
    nodes.each do |child|
        break if child.nil?
        list << child.accept( self )
    end
    return list
end