Sha256: 1b506e301ef11cbfab28ca752e0466a38ddde9582da3c7d0041cc4977fedecbf

Contents?: true

Size: 566 Bytes

Versions: 3

Compression:

Stored size: 566 Bytes

Contents

module Authpds
  module ActsAsAuthentic
    module Expiration
      def self.included(klass)
        klass.class_eval { attr_accessor :expiration_date }
      end

      # 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.
      def expired?
        # If the record is older than the expiration date, it is expired.
        (refreshed_at.nil?) ? true : refreshed_at < expiration_date
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
authpds-1.1.5 lib/authpds/acts_as_authentic/expiration.rb
authpds-1.1.4 lib/authpds/acts_as_authentic/expiration.rb
authpds-1.1.3 lib/authpds/acts_as_authentic/expiration.rb