Class: LogBook::Tree::Node
- Inherits:
-
Object
- Object
- LogBook::Tree::Node
- Defined in:
- lib/log_book/tree.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#depth ⇒ Object
Returns the value of attribute depth.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value) ⇒ Node
constructor
A new instance of Node.
- #merge(new_value) ⇒ Object
Constructor Details
#initialize(value) ⇒ Node
Returns a new instance of Node.
68 69 70 71 72 |
# File 'lib/log_book/tree.rb', line 68 def initialize(value) @value = value @depth = 0 @children = [] end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
65 66 67 |
# File 'lib/log_book/tree.rb', line 65 def children @children end |
#depth ⇒ Object
Returns the value of attribute depth.
66 67 68 |
# File 'lib/log_book/tree.rb', line 66 def depth @depth end |
#parent ⇒ Object
Returns the value of attribute parent.
64 65 66 |
# File 'lib/log_book/tree.rb', line 64 def parent @parent end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
63 64 65 |
# File 'lib/log_book/tree.rb', line 63 def value @value end |
Instance Method Details
#merge(new_value) ⇒ Object
74 75 76 77 |
# File 'lib/log_book/tree.rb', line 74 def merge(new_value) value.record_changes = new_value.record_changes self end |