module Expirable
Expirable
¶ ↑
Generic expirability mixin.
Attributes
expiration[R]
Public Instance Methods
expiration=(time)
click to toggle source
Set the expires timeout for this entry.
# File lib/mixers/expirable.rb, line 10 def expiration=(time) case time when Time, Date, DateTime @expiration = time else @expiration = Time.now + time end end
expired?()
click to toggle source
Is this entry expired?
# File lib/mixers/expirable.rb, line 27 def expired? return true if expiration.nil? return true if (Time.now > expiration) return false end
touch!()
click to toggle source
Update the expiration period. Override in your application.
# File lib/mixers/expirable.rb, line 34 def touch! end