Class: Hashery::LRUHash::Node
Overview
A single node in the doubly linked LRU list of nodes.
Instance Attribute Summary collapse
-
#key ⇒ Object
private
Returns the value of attribute key.
-
#pred ⇒ Object
private
Returns the value of attribute pred.
-
#succ ⇒ Object
private
Returns the value of attribute succ.
-
#value ⇒ Object
private
Returns the value of attribute value.
Instance Method Summary collapse
Instance Attribute Details
#key ⇒ Object (private)
Returns the value of attribute key
337 338 339 |
# File 'lib/hashery/lru_hash.rb', line 337 def key @key end |
#pred ⇒ Object (private)
Returns the value of attribute pred
337 338 339 |
# File 'lib/hashery/lru_hash.rb', line 337 def pred @pred end |
#succ ⇒ Object (private)
Returns the value of attribute succ
337 338 339 |
# File 'lib/hashery/lru_hash.rb', line 337 def succ @succ end |
#value ⇒ Object (private)
Returns the value of attribute value
337 338 339 |
# File 'lib/hashery/lru_hash.rb', line 337 def value @value end |
Instance Method Details
#insert_after(node) ⇒ Object
345 346 347 348 349 350 351 352 353 354 355 356 357 358 |
# File 'lib/hashery/lru_hash.rb', line 345 def insert_after(node) raise 'Cannot insert after self' if equal? node return self if node.succ.equal? self unlink self.succ = node.succ self.pred = node node.succ.pred = self if node.succ node.succ = self self end |
#unlink ⇒ Object
338 339 340 341 342 343 |
# File 'lib/hashery/lru_hash.rb', line 338 def unlink pred.succ = succ if pred succ.pred = pred if succ self.succ = self.pred = nil self end |