Class: Node
- Inherits:
-
Object
- Object
- Node
- Defined in:
- lib/honey_mushroom/node.rb
Constant Summary collapse
- @@auto_increment =
0
Instance Attribute Summary collapse
-
#edges ⇒ Object
Returns the value of attribute edges.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#last ⇒ Object
Returns the value of attribute last.
-
#left ⇒ Object
Returns the value of attribute left.
-
#next ⇒ Object
Returns the value of attribute next.
-
#right ⇒ Object
Returns the value of attribute right.
-
#value ⇒ Object
Returns the value of attribute value.
-
#value2 ⇒ Object
Returns the value of attribute value2.
-
#value3 ⇒ Object
Returns the value of attribute value3.
-
#value4 ⇒ Object
Returns the value of attribute value4.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(args = {}) ⇒ Node
Returns a new instance of Node.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/honey_mushroom/node.rb', line 7 def initialize(args={}) @value = args.fetch(:value, nil) @edges = args.fetch(:edges, nil) if args.include?(:edges ) @next = args.fetch(:next, nil) if args.include?(:next ) @last = args.fetch(:last, nil) if args.include?(:last ) @left = args.fetch(:left, nil) if args.include?(:left ) @right = args.fetch(:right, nil) if args.include?(:right ) @value2 = args.fetch(:value2, nil) if args.include?(:value2) @value3 = args.fetch(:value3, nil) if args.include?(:value3) @value4 = args.fetch(:value4, nil) if args.include?(:value4) @id = args.fetch(:id, @@auto_increment) @@auto_increment += 1 end |
Instance Attribute Details
#edges ⇒ Object
Returns the value of attribute edges.
4 5 6 |
# File 'lib/honey_mushroom/node.rb', line 4 def edges @edges end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/honey_mushroom/node.rb', line 3 def id @id end |
#last ⇒ Object
Returns the value of attribute last.
4 5 6 |
# File 'lib/honey_mushroom/node.rb', line 4 def last @last end |
#left ⇒ Object
Returns the value of attribute left.
4 5 6 |
# File 'lib/honey_mushroom/node.rb', line 4 def left @left end |
#next ⇒ Object
Returns the value of attribute next.
4 5 6 |
# File 'lib/honey_mushroom/node.rb', line 4 def next @next end |
#right ⇒ Object
Returns the value of attribute right.
4 5 6 |
# File 'lib/honey_mushroom/node.rb', line 4 def right @right end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/honey_mushroom/node.rb', line 4 def value @value end |
#value2 ⇒ Object
Returns the value of attribute value2.
4 5 6 |
# File 'lib/honey_mushroom/node.rb', line 4 def value2 @value2 end |
#value3 ⇒ Object
Returns the value of attribute value3.
4 5 6 |
# File 'lib/honey_mushroom/node.rb', line 4 def value3 @value3 end |
#value4 ⇒ Object
Returns the value of attribute value4.
4 5 6 |
# File 'lib/honey_mushroom/node.rb', line 4 def value4 @value4 end |