Class: DepthTreeNodeVisitor
- Inherits:
-
TreeNodeVisitor
- Object
- TreeNodeVisitor
- DepthTreeNodeVisitor
- Defined in:
- lib/tree_visitor/tree_node_visitor.rb
Instance Attribute Summary collapse
-
#depth ⇒ Object
readonly
Returns the value of attribute depth.
Instance Method Summary collapse
- #enter_treeNode(treeNode) ⇒ Object
- #exit_treeNode(treeNode) ⇒ Object
-
#initialize ⇒ DepthTreeNodeVisitor
constructor
A new instance of DepthTreeNodeVisitor.
- #visit_leafNode(leafNode) ⇒ Object
Constructor Details
#initialize ⇒ DepthTreeNodeVisitor
Returns a new instance of DepthTreeNodeVisitor.
111 112 113 114 |
# File 'lib/tree_visitor/tree_node_visitor.rb', line 111 def initialize super @depth = 0 end |
Instance Attribute Details
#depth ⇒ Object (readonly)
Returns the value of attribute depth.
109 110 111 |
# File 'lib/tree_visitor/tree_node_visitor.rb', line 109 def depth @depth end |
Instance Method Details
#enter_treeNode(treeNode) ⇒ Object
116 117 118 |
# File 'lib/tree_visitor/tree_node_visitor.rb', line 116 def enter_treeNode( treeNode ) @depth += 1 end |
#exit_treeNode(treeNode) ⇒ Object
120 121 122 |
# File 'lib/tree_visitor/tree_node_visitor.rb', line 120 def exit_treeNode( treeNode ) @depth -= 1 end |
#visit_leafNode(leafNode) ⇒ Object
124 125 |
# File 'lib/tree_visitor/tree_node_visitor.rb', line 124 def visit_leafNode( leafNode ) end |