Class: YARP::BasicVisitor
- Inherits:
-
Object
- Object
- YARP::BasicVisitor
- Defined in:
- lib/yarp.rb
Overview
A class that knows how to walk down the tree. None of the individual visit methods are implemented on this visitor, so it forces the consumer to implement each one that they need. For a default implementation that continues walking the tree, see the Visitor class.
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#visit(node) ⇒ Object
159 160 161 |
# File 'lib/yarp.rb', line 159 def visit(node) node&.accept(self) end |
#visit_all(nodes) ⇒ Object
163 164 165 |
# File 'lib/yarp.rb', line 163 def visit_all(nodes) nodes.map { |node| visit(node) } end |
#visit_child_nodes(node) ⇒ Object
167 168 169 |
# File 'lib/yarp.rb', line 167 def visit_child_nodes(node) visit_all(node.child_nodes) end |