Class: Node
- Inherits:
-
Object
- Object
- Node
- 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
-
#next_node ⇒ Object
Returns the value of attribute next_node.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value = nil, next_node = nil) ⇒ Node
constructor
A new instance of Node.
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_node ⇒ Object
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 |
#value ⇒ Object
Returns the value of attribute value.
5 6 7 |
# File 'lib/shea-linked_list/node.rb', line 5 def value @value end |