Class: DataStructures101::LinkedList::Node
- Inherits:
-
Object
- Object
- DataStructures101::LinkedList::Node
- Defined in:
- lib/data_structures_101/linked_list.rb
Instance Attribute Summary collapse
-
#next ⇒ Object
Returns the value of attribute next.
-
#prev ⇒ Object
Returns the value of attribute prev.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value, prev = nil, _next = nil) ⇒ Node
constructor
A new instance of Node.
- #to_s ⇒ Object
Constructor Details
#initialize(value, prev = nil, _next = nil) ⇒ Node
Returns a new instance of Node.
9 10 11 12 13 |
# File 'lib/data_structures_101/linked_list.rb', line 9 def initialize(value, prev = nil, _next = nil) @value = value @next = _next @prev = prev end |
Instance Attribute Details
#next ⇒ Object
Returns the value of attribute next.
7 8 9 |
# File 'lib/data_structures_101/linked_list.rb', line 7 def next @next end |
#prev ⇒ Object
Returns the value of attribute prev.
7 8 9 |
# File 'lib/data_structures_101/linked_list.rb', line 7 def prev @prev end |
#value ⇒ Object
Returns the value of attribute value.
7 8 9 |
# File 'lib/data_structures_101/linked_list.rb', line 7 def value @value end |
Instance Method Details
#to_s ⇒ Object
15 16 17 |
# File 'lib/data_structures_101/linked_list.rb', line 15 def to_s "<value=#{value}>" end |