Class: TreeStand::Visitors::TreeWalker
- Inherits:
-
TreeStand::Visitor
- Object
- TreeStand::Visitor
- TreeStand::Visitors::TreeWalker
- Extended by:
- T::Sig
- Defined in:
- lib/tree_stand/visitors/tree_walker.rb
Overview
Walks the tree depth-first and yields each node to the provided block.
Instance Method Summary collapse
-
#initialize(node, &block) ⇒ TreeWalker
constructor
A new instance of TreeWalker.
- #on(node) ⇒ Object
Methods inherited from TreeStand::Visitor
Constructor Details
#initialize(node, &block) ⇒ TreeWalker
Returns a new instance of TreeWalker.
28 29 30 31 |
# File 'lib/tree_stand/visitors/tree_walker.rb', line 28 def initialize(node, &block) super(node) @block = block end |
Instance Method Details
#on(node) ⇒ Object
34 |
# File 'lib/tree_stand/visitors/tree_walker.rb', line 34 def on(node) = @block.call(node) |