Class: Prism::BasicVisitor
- Inherits:
-
Object
- Object
- Prism::BasicVisitor
- Defined in:
- lib/prism/visitor.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
14 15 16 |
# File 'lib/prism/visitor.rb', line 14 def visit(node) node&.accept(self) end |
#visit_all(nodes) ⇒ Object
18 19 20 |
# File 'lib/prism/visitor.rb', line 18 def visit_all(nodes) nodes.each { |node| node&.accept(self) } end |
#visit_child_nodes(node) ⇒ Object
22 23 24 |
# File 'lib/prism/visitor.rb', line 22 def visit_child_nodes(node) node.compact_child_nodes.each { |node| node.accept(self) } end |