Class: HashCache::LinkedList::Node

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, pointers = {}) ⇒ Node

Returns a new instance of Node.



103
104
105
106
107
# File 'lib/hash_cache/linked_list.rb', line 103

def initialize(value, pointers = {})
  self.value = value
  self.right = pointers[:right]
  self.left  = pointers[:left]
end

Instance Attribute Details

#leftObject

Returns the value of attribute left.



102
103
104
# File 'lib/hash_cache/linked_list.rb', line 102

def left
  @left
end

#rightObject

Returns the value of attribute right.



102
103
104
# File 'lib/hash_cache/linked_list.rb', line 102

def right
  @right
end

#valueObject

Returns the value of attribute value.



102
103
104
# File 'lib/hash_cache/linked_list.rb', line 102

def value
  @value
end

Instance Method Details

#left?Boolean

Returns:

  • (Boolean)


110
# File 'lib/hash_cache/linked_list.rb', line 110

def left?;  !left.nil?   end

#right?Boolean

Returns:

  • (Boolean)


109
# File 'lib/hash_cache/linked_list.rb', line 109

def right?; !right.nil?; end