Module: Authpds::ActsAsAuthentic::Expiration

Defined in:
lib/authpds/acts_as_authentic/expiration.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



4
5
6
# File 'lib/authpds/acts_as_authentic/expiration.rb', line 4

def self.included(klass)
  klass.class_eval { attr_accessor :expiration_date }
end

Instance Method Details

#expired?Boolean

Returns a boolean based on whether the User has been refreshed recently. If User#refreshed_at is older than User#expiration_date, the User is expired and the data may need to be refreshed.

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/authpds/acts_as_authentic/expiration.rb', line 11

def expired?
  # If the record is older than the expiration date, it is expired.
  (refreshed_at.nil?) ? true : refreshed_at < expiration_date
end