Module: Expirable

Defined in:
lib/mixers/expirable.rb

Overview

Expirable

Generic expirability mixin.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#expirationObject

Returns the value of attribute expiration.



7
8
9
# File 'lib/mixers/expirable.rb', line 7

def expiration
  @expiration
end

Instance Method Details

#expired?Boolean

Is this entry expired?

Returns:

  • (Boolean)


27
28
29
30
31
# File 'lib/mixers/expirable.rb', line 27

def expired?
  return true if expiration.nil?
  return true if (Time.now > expiration)
  return false
end

#touch!Object

Update the expiration period. Override in your application.



34
35
# File 'lib/mixers/expirable.rb', line 34

def touch!
end