Class: LogBook::Tree::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/log_book/tree.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#childrenObject

Returns the value of attribute children.



65
66
67
# File 'lib/log_book/tree.rb', line 65

def children
  @children
end

#depthObject

Returns the value of attribute depth.



66
67
68
# File 'lib/log_book/tree.rb', line 66

def depth
  @depth
end

#parentObject

Returns the value of attribute parent.



64
65
66
# File 'lib/log_book/tree.rb', line 64

def parent
  @parent
end

#valueObject (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