module Authpds::ActsAsAuthentic::Expiration

Public Class Methods

included(klass) click to toggle source
# File lib/authpds/acts_as_authentic/expiration.rb, line 4
def self.included(klass)
  klass.class_eval { attr_accessor :expiration_date }
end

Public Instance Methods

expired?() click to toggle source

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.

# 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