Class: Hashery::LinkedList::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/hashery/linked_list.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.



35
36
37
38
39
40
# File 'lib/hashery/linked_list.rb', line 35

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.



33
34
35
# File 'lib/hashery/linked_list.rb', line 33

def key
  @key
end

#next_nodeObject

Returns the value of attribute next_node.



33
34
35
# File 'lib/hashery/linked_list.rb', line 33

def next_node
  @next_node
end

#prev_nodeObject

Returns the value of attribute prev_node.



33
34
35
# File 'lib/hashery/linked_list.rb', line 33

def prev_node
  @prev_node
end

#valueObject

Returns the value of attribute value.



33
34
35
# File 'lib/hashery/linked_list.rb', line 33

def value
  @value
end