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.
7 8 9 10 11 |
# File 'lib/linked-list/node.rb', line 7 def initialize(data) @data = data @next = nil @prev = nil end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
5 6 7 |
# File 'lib/linked-list/node.rb', line 5 def data @data end |
#next ⇒ Object
Returns the value of attribute next.
5 6 7 |
# File 'lib/linked-list/node.rb', line 5 def next @next end |
#prev ⇒ Object
Returns the value of attribute prev.
5 6 7 |
# File 'lib/linked-list/node.rb', line 5 def prev @prev end |
Instance Method Details
#to_node ⇒ Object
Conversion function, see Conversions.Node
.
Returns:
self
18 19 20 |
# File 'lib/linked-list/node.rb', line 18 def to_node self end |