Class: Ds101::LinkedList::DoubleLinkedList::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/ds_101/linked_list/double_linked_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value:, next_node: nil, prev_node: nil) ⇒ Node

Returns a new instance of Node.



13
14
15
16
17
# File 'lib/ds_101/linked_list/double_linked_list.rb', line 13

def initialize(value:, next_node: nil, prev_node: nil)
  @value = value
  @next = next_node
  @prev = prev_node
end

Instance Attribute Details

#nextObject

Returns the value of attribute next.



11
12
13
# File 'lib/ds_101/linked_list/double_linked_list.rb', line 11

def next
  @next
end

#prevObject

Returns the value of attribute prev.



11
12
13
# File 'lib/ds_101/linked_list/double_linked_list.rb', line 11

def prev
  @prev
end

#valueObject

Returns the value of attribute value.



11
12
13
# File 'lib/ds_101/linked_list/double_linked_list.rb', line 11

def value
  @value
end