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(identity:, value:, parent:, children:) ⇒ Node

Returns a new instance of Node.



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

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

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



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

def children
  @children
end

#identityObject (readonly)

Returns the value of attribute identity.



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

def identity
  @identity
end

#parentObject (readonly)

Returns the value of attribute parent.



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

def parent
  @parent
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



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

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