Class: CacheLib::UtilHash
- Inherits:
-
Hash
- Object
- Hash
- CacheLib::UtilHash
- Defined in:
- lib/cache_lib/util_hash.rb
Instance Method Summary collapse
- #head_key ⇒ Object
- #pop_tail ⇒ Object
- #refresh(key) ⇒ Object
- #set_head(key, value) ⇒ Object
- #set_tail(key, value) ⇒ Object
- #tail ⇒ Object
Instance Method Details
#head_key ⇒ Object
3 4 5 |
# File 'lib/cache_lib/util_hash.rb', line 3 def head_key keys.last end |
#pop_tail ⇒ Object
20 21 22 |
# File 'lib/cache_lib/util_hash.rb', line 20 def pop_tail delete(first[0]) end |
#refresh(key) ⇒ Object
24 25 26 27 |
# File 'lib/cache_lib/util_hash.rb', line 24 def refresh(key) value = delete(key) self[key] = value end |
#set_head(key, value) ⇒ Object
11 12 13 14 |
# File 'lib/cache_lib/util_hash.rb', line 11 def set_head(key, value) delete(key) self[key] = value end |
#set_tail(key, value) ⇒ Object
16 17 18 |
# File 'lib/cache_lib/util_hash.rb', line 16 def set_tail(key, value) replace(Hash[key, value].merge(self)) end |
#tail ⇒ Object
7 8 9 |
# File 'lib/cache_lib/util_hash.rb', line 7 def tail first end |