Class: Moneta::DataMapper::Expiration
- Inherits:
-
Object
- Object
- Moneta::DataMapper::Expiration
- Defined in:
- lib/moneta/datamapper.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #delete(key) ⇒ Object
-
#initialize(klass) ⇒ Expiration
constructor
A new instance of Expiration.
Constructor Details
#initialize(klass) ⇒ Expiration
Returns a new instance of Expiration.
29 30 31 |
# File 'lib/moneta/datamapper.rb', line 29 def initialize(klass) @klass = klass end |
Instance Method Details
#[](key) ⇒ Object
33 34 35 36 37 |
# File 'lib/moneta/datamapper.rb', line 33 def [](key) if obj = get(key) obj.expires end end |
#[]=(key, value) ⇒ Object
39 40 41 42 43 |
# File 'lib/moneta/datamapper.rb', line 39 def []=(key, value) obj = get(key) obj.expires = value obj.save end |
#delete(key) ⇒ Object
45 46 47 48 49 |
# File 'lib/moneta/datamapper.rb', line 45 def delete(key) obj = get(key) obj.expires = nil obj.save end |