Class: ThreadSafeLru::ListNode
- Inherits:
-
Object
- Object
- ThreadSafeLru::ListNode
- Defined in:
- lib/threadsafe-lru/DoubleLinkedList.rb
Instance Attribute Summary collapse
-
#next ⇒ Object
Returns the value of attribute next.
-
#prev ⇒ Object
Returns the value of attribute prev.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value) ⇒ ListNode
constructor
A new instance of ListNode.
- #insert_between(prev_node, next_node) ⇒ Object
- #remove ⇒ Object
Constructor Details
#initialize(value) ⇒ ListNode
Returns a new instance of ListNode.
3 4 5 |
# File 'lib/threadsafe-lru/DoubleLinkedList.rb', line 3 def initialize value @value=value end |
Instance Attribute Details
#next ⇒ Object
Returns the value of attribute next.
23 24 25 |
# File 'lib/threadsafe-lru/DoubleLinkedList.rb', line 23 def next @next end |
#prev ⇒ Object
Returns the value of attribute prev.
24 25 26 |
# File 'lib/threadsafe-lru/DoubleLinkedList.rb', line 24 def prev @prev end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
22 23 24 |
# File 'lib/threadsafe-lru/DoubleLinkedList.rb', line 22 def value @value end |
Instance Method Details
#insert_between(prev_node, next_node) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/threadsafe-lru/DoubleLinkedList.rb', line 7 def insert_between prev_node, next_node self.next=next_node self.prev=prev_node prev_node.next=self next_node.prev=self self end |
#remove ⇒ Object
15 16 17 18 19 20 |
# File 'lib/threadsafe-lru/DoubleLinkedList.rb', line 15 def remove self.prev.next=self.next self.next.prev=self.prev self.next=nil self.prev=nil end |