Class: Cache::LinkedList::Element
- Inherits:
-
Object
- Object
- Cache::LinkedList::Element
- Defined in:
- lib/background_queue/server_lib/lru.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#next_element ⇒ Object
Returns the value of attribute next_element.
-
#previous_element ⇒ Object
Returns the value of attribute previous_element.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(key, value, next_element) ⇒ Element
constructor
A new instance of Element.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(key, value, next_element) ⇒ Element
Returns a new instance of Element.
172 173 174 175 176 177 |
# File 'lib/background_queue/server_lib/lru.rb', line 172 def initialize(key, value, next_element) @key = key @value = value @next_element = next_element @previous_element = nil end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
171 172 173 |
# File 'lib/background_queue/server_lib/lru.rb', line 171 def key @key end |
#next_element ⇒ Object
Returns the value of attribute next_element.
171 172 173 |
# File 'lib/background_queue/server_lib/lru.rb', line 171 def next_element @next_element end |
#previous_element ⇒ Object
Returns the value of attribute previous_element.
171 172 173 |
# File 'lib/background_queue/server_lib/lru.rb', line 171 def previous_element @previous_element end |
#value ⇒ Object
Returns the value of attribute value.
171 172 173 |
# File 'lib/background_queue/server_lib/lru.rb', line 171 def value @value end |
Instance Method Details
#inspect ⇒ Object
179 180 181 |
# File 'lib/background_queue/server_lib/lru.rb', line 179 def inspect to_s end |
#to_s ⇒ Object
183 184 185 186 187 |
# File 'lib/background_queue/server_lib/lru.rb', line 183 def to_s p = @previous_element ? @previous_element.key : 'nil' n = @next_element ? @next_element.key : 'nil' "[#{@key}: #{@value.inspect}, previous: #{p}, next: #{n}]" end |