Class: AsciiTree::Node
- Inherits:
-
Object
- Object
- AsciiTree::Node
- Defined in:
- lib/ascii_tree/node.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(id:, value:, parent:, children:) ⇒ Node
constructor
A new instance of Node.
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
#children ⇒ Object (readonly)
Returns the value of attribute children.
4 5 6 |
# File 'lib/ascii_tree/node.rb', line 4 def children @children end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/ascii_tree/node.rb', line 4 def id @id end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
4 5 6 |
# File 'lib/ascii_tree/node.rb', line 4 def parent @parent end |
#value ⇒ Object (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 |