Class: Glimmer::XML::DepthFirstSearchIterator
- Inherits:
-
Object
- Object
- Glimmer::XML::DepthFirstSearchIterator
- Defined in:
- lib/glimmer/xml/depth_first_search_iterator.rb
Instance Method Summary collapse
-
#initialize(node, node_visitor) ⇒ DepthFirstSearchIterator
constructor
A new instance of DepthFirstSearchIterator.
- #iterate ⇒ Object
- #process(node) ⇒ Object
Constructor Details
#initialize(node, node_visitor) ⇒ DepthFirstSearchIterator
Returns a new instance of DepthFirstSearchIterator.
27 28 29 30 |
# File 'lib/glimmer/xml/depth_first_search_iterator.rb', line 27 def initialize(node, node_visitor) @node = node @node_visitor = node_visitor end |
Instance Method Details
#iterate ⇒ Object
32 33 34 |
# File 'lib/glimmer/xml/depth_first_search_iterator.rb', line 32 def iterate process(@node) end |
#process(node) ⇒ Object
36 37 38 39 40 |
# File 'lib/glimmer/xml/depth_first_search_iterator.rb', line 36 def process(node) @node_visitor.process_before_children(node) node.children.each { |child| process(child) } if node.is_a?(Node) @node_visitor.process_after_children(node) end |