Class: LinkedList::Node
- Inherits:
-
Object
- Object
- LinkedList::Node
- Defined in:
- lib/linked-list/node.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#next ⇒ Object
Returns the value of attribute next.
-
#prev ⇒ Object
Returns the value of attribute prev.
Instance Method Summary collapse
-
#initialize(data) ⇒ Node
constructor
A new instance of Node.
-
#to_node ⇒ Object
Conversion function, see
Conversions.Node.
Constructor Details
#initialize(data) ⇒ Node
Returns a new instance of Node.
5 6 7 8 9 |
# File 'lib/linked-list/node.rb', line 5 def initialize(data) @data = data @next = nil @prev = nil end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
3 4 5 |
# File 'lib/linked-list/node.rb', line 3 def data @data end |
#next ⇒ Object
Returns the value of attribute next.
3 4 5 |
# File 'lib/linked-list/node.rb', line 3 def next @next end |
#prev ⇒ Object
Returns the value of attribute prev.
3 4 5 |
# File 'lib/linked-list/node.rb', line 3 def prev @prev end |
Instance Method Details
#to_node ⇒ Object
Conversion function, see Conversions.Node.
Returns:
self
16 17 18 |
# File 'lib/linked-list/node.rb', line 16 def to_node self end |