Class: AsciiTree::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/ascii_tree/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, value:, parent:, children:) ⇒ Node

Returns a new instance of Node.



6
7
8
9
10
11
# File 'lib/ascii_tree/node.rb', line 6

def initialize(id:, value:, parent:, children:)
  @id       = id
  @value    = value
  @parent   = parent
  @children = children
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



4
5
6
# File 'lib/ascii_tree/node.rb', line 4

def children
  @children
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/ascii_tree/node.rb', line 4

def id
  @id
end

#parentObject (readonly)

Returns the value of attribute parent.



4
5
6
# File 'lib/ascii_tree/node.rb', line 4

def parent
  @parent
end

#valueObject (readonly)

Returns the value of attribute value.



4
5
6
# File 'lib/ascii_tree/node.rb', line 4

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



13
14
15
16
17
18
# File 'lib/ascii_tree/node.rb', line 13

def ==(other)
  id == other.id &&
    value == other.value &&
    parent == other.parent &&
    children == other.children
end