Class: LeafNode
Overview
Deriva da AbsNode
definisce un metodo to_str
Instance Attribute Summary
Attributes inherited from AbsNode
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
-
#initialize(name, parent = nil) ⇒ LeafNode
constructor
A new instance of LeafNode.
- #to_str ⇒ Object
Methods inherited from AbsNode
#depth, #invalidate, #path, #path_from_root, #prefix_path, #prefix_path=, #root
Constructor Details
#initialize(name, parent = nil) ⇒ LeafNode
Returns a new instance of LeafNode.
12 13 14 15 16 17 |
# File 'lib/tree_visitor/leaf_node.rb', line 12 def initialize( name, parent = nil ) super( name ) if parent parent.add_leaf( self ) end end |
Instance Method Details
#accept(visitor) ⇒ Object
19 20 21 |
# File 'lib/tree_visitor/leaf_node.rb', line 19 def accept( visitor ) visitor.visit_leafNode( self ) end |
#to_str ⇒ Object
23 24 25 |
# File 'lib/tree_visitor/leaf_node.rb', line 23 def to_str name.to_str end |