Class: Moneta::Expiration
- Inherits:
-
Object
- Object
- Moneta::Expiration
- Defined in:
- lib/moneta/lmc.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #delete(key) ⇒ Object
-
#initialize(hash) ⇒ Expiration
constructor
A new instance of Expiration.
Constructor Details
#initialize(hash) ⇒ Expiration
Returns a new instance of Expiration.
10 11 12 |
# File 'lib/moneta/lmc.rb', line 10 def initialize(hash) @hash = hash end |
Instance Method Details
#[](key) ⇒ Object
14 |
# File 'lib/moneta/lmc.rb', line 14 def [](key) @hash["#{key}__!__expiration"] end |
#[]=(key, value) ⇒ Object
15 |
# File 'lib/moneta/lmc.rb', line 15 def []=(key, value) @hash["#{key}__!__expiration"] = value end |
#delete(key) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/moneta/lmc.rb', line 17 def delete(key) key = "#{key}__!__expiration" value = @hash[key] @hash.delete(key) value end |