Class: TreeRb::FlatPrintTreeNodeVisitor

Inherits:
Object
  • Object
show all
Defined in:
lib/tree_rb/visitors/flat_print_tree_node_visitor.rb

Overview

Print for every node the name

Instance Method Summary collapse

Instance Method Details

#cannot_enter_node(tree_node, error) ⇒ Object

called when the tree node is not accessible or an exception is raise when the node is accessed



18
19
# File 'lib/tree_rb/visitors/flat_print_tree_node_visitor.rb', line 18

def cannot_enter_node( tree_node, error)
end

#enter_node(tree_node) ⇒ Object

< BasicTreeNodeVisitor



8
9
10
# File 'lib/tree_rb/visitors/flat_print_tree_node_visitor.rb', line 8

def enter_node( tree_node )
  puts tree_node.name
end

#exit_node(tree_node) ⇒ Object



12
13
# File 'lib/tree_rb/visitors/flat_print_tree_node_visitor.rb', line 12

def exit_node( tree_node )
end

#visit_leaf(leaf_node) ⇒ Object



21
22
23
# File 'lib/tree_rb/visitors/flat_print_tree_node_visitor.rb', line 21

def visit_leaf( leaf_node )
  puts leaf_node.name
end