Class: LinkedList::Node

Inherits:
Object show all
Defined in:
lib/more/facets/linkedlist.rb

Overview

Represents a single node of the linked list.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key = nil, value = nil, prev_node = nil, next_node = nil) ⇒ Node

Returns a new instance of Node.



71
72
73
74
75
76
# File 'lib/more/facets/linkedlist.rb', line 71

def initialize(key=nil,value=nil,prev_node=nil,next_node=nil)
        @key = key
        @value = value
        @prev_node = prev_node
        @next_node = next_node
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



69
70
71
# File 'lib/more/facets/linkedlist.rb', line 69

def key
  @key
end

#next_nodeObject

Returns the value of attribute next_node.



69
70
71
# File 'lib/more/facets/linkedlist.rb', line 69

def next_node
  @next_node
end

#prev_nodeObject

Returns the value of attribute prev_node.



69
70
71
# File 'lib/more/facets/linkedlist.rb', line 69

def prev_node
  @prev_node
end

#valueObject

Returns the value of attribute value.



69
70
71
# File 'lib/more/facets/linkedlist.rb', line 69

def value
  @value
end