Class: Node
- Inherits:
-
Object
- Object
- Node
- Defined in:
- lib/connect_four/data_structure/node.rb
Overview
class Node for creating node objects
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#next ⇒ Object
Returns the value of attribute next.
Instance Method Summary collapse
-
#initialize(data = nil, next_pointer = nil) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(data = nil, next_pointer = nil) ⇒ Node
Returns a new instance of Node.
7 8 9 10 11 12 |
# File 'lib/connect_four/data_structure/node.rb', line 7 def initialize(data = nil, next_pointer = nil) # stored data of the node @data = data # pointer to next node in list @next = next_pointer end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
5 6 7 |
# File 'lib/connect_four/data_structure/node.rb', line 5 def data @data end |
#next ⇒ Object
Returns the value of attribute next.
5 6 7 |
# File 'lib/connect_four/data_structure/node.rb', line 5 def next @next end |