Class: DoublyLinkedlist::Node
- Inherits:
-
Object
- Object
- DoublyLinkedlist::Node
- Defined in:
- lib/doubly_linkedlist/node.rb
Overview
Creates a node with value and links to next/previous nodes.
Instance Attribute Summary collapse
-
#next ⇒ Node
The next/previous node object.
-
#prev ⇒ Node
The next/previous node object.
-
#value ⇒ Object
readonly
The node value.
Instance Method Summary collapse
-
#initialize(value) ⇒ Node
constructor
Initializes a node with the given object as its value.
Constructor Details
#initialize(value) ⇒ Node
Initializes a node with the given object as its value.
15 16 17 |
# File 'lib/doubly_linkedlist/node.rb', line 15 def initialize(value) @value = value end |
Instance Attribute Details
#next ⇒ Node
Returns the next/previous node object.
10 11 12 |
# File 'lib/doubly_linkedlist/node.rb', line 10 def next @next end |
#prev ⇒ Node
Returns the next/previous node object.
10 11 12 |
# File 'lib/doubly_linkedlist/node.rb', line 10 def prev @prev end |
#value ⇒ Object (readonly)
Returns the node value.
7 8 9 |
# File 'lib/doubly_linkedlist/node.rb', line 7 def value @value end |