Class: Node

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

Overview

class Node for creating node objects

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject

Returns the value of attribute data.



5
6
7
# File 'lib/connect_four/data_structure/node.rb', line 5

def data
  @data
end

#nextObject

Returns the value of attribute next.



5
6
7
# File 'lib/connect_four/data_structure/node.rb', line 5

def next
  @next
end