Class: TraceGraph::TraceNode
- Inherits:
-
Object
- Object
- TraceGraph::TraceNode
- Includes:
- TreeGraph
- Defined in:
- lib/trace_graph/trace_node.rb
Instance Attribute Summary collapse
-
#class_name ⇒ Object
Returns the value of attribute class_name.
-
#is_duplicate ⇒ Object
Returns the value of attribute is_duplicate.
-
#label ⇒ Object
(also: #label_for_tree_graph)
Returns the value of attribute label.
-
#sub_nodes ⇒ Object
(also: #children_for_tree_graph)
Returns the value of attribute sub_nodes.
Instance Method Summary collapse
- #<<(child_node) ⇒ Object
- #first ⇒ Object
-
#initialize(label, is_duplicate: false, class_name: nil) ⇒ TraceNode
constructor
A new instance of TraceNode.
- #node_count ⇒ Object
- #second ⇒ Object
Constructor Details
#initialize(label, is_duplicate: false, class_name: nil) ⇒ TraceNode
Returns a new instance of TraceNode.
14 15 16 17 18 19 |
# File 'lib/trace_graph/trace_node.rb', line 14 def initialize(label, is_duplicate: false, class_name: nil) self.label = label self.is_duplicate = is_duplicate self.sub_nodes = [] self.class_name = class_name end |
Instance Attribute Details
#class_name ⇒ Object
Returns the value of attribute class_name.
9 10 11 |
# File 'lib/trace_graph/trace_node.rb', line 9 def class_name @class_name end |
#is_duplicate ⇒ Object
Returns the value of attribute is_duplicate.
8 9 10 |
# File 'lib/trace_graph/trace_node.rb', line 8 def is_duplicate @is_duplicate end |
#label ⇒ Object Also known as: label_for_tree_graph
Returns the value of attribute label.
6 7 8 |
# File 'lib/trace_graph/trace_node.rb', line 6 def label @label end |
#sub_nodes ⇒ Object Also known as: children_for_tree_graph
Returns the value of attribute sub_nodes.
7 8 9 |
# File 'lib/trace_graph/trace_node.rb', line 7 def sub_nodes @sub_nodes end |
Instance Method Details
#<<(child_node) ⇒ Object
21 22 23 |
# File 'lib/trace_graph/trace_node.rb', line 21 def << child_node sub_nodes << child_node end |
#first ⇒ Object
29 30 31 |
# File 'lib/trace_graph/trace_node.rb', line 29 def first sub_nodes.first end |
#node_count ⇒ Object
25 26 27 |
# File 'lib/trace_graph/trace_node.rb', line 25 def node_count sub_nodes.length end |
#second ⇒ Object
33 34 35 |
# File 'lib/trace_graph/trace_node.rb', line 33 def second sub_nodes[1] end |