Class: Node

Inherits:
Object
  • Object
show all
Defined in:
lib/shea-linked_list/node.rb

Overview

Holds a single element of data and a link/pointer to the next Node in the LinkedList

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value = nil, next_node = nil) ⇒ Node

Returns a new instance of Node.



7
8
9
10
# File 'lib/shea-linked_list/node.rb', line 7

def initialize(value = nil, next_node = nil)
  @value = value
  @next_node = next_node
end

Instance Attribute Details

#next_nodeObject

Returns the value of attribute next_node.



5
6
7
# File 'lib/shea-linked_list/node.rb', line 5

def next_node
  @next_node
end

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/shea-linked_list/node.rb', line 5

def value
  @value
end