Sha256: e19eb917c70537bf7105eca580abe81806eb68de026c2545c57fb525cfc1a5bb

Contents?: true

Size: 586 Bytes

Versions: 13

Compression:

Stored size: 586 Bytes

Contents

module Authpds
  module ActsAsAuthentic
    module Expiration
      def self.included(klass)
        klass.class_eval do
          attr_accessor :expiration_date
        end
      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

13 entries across 13 versions & 1 rubygems

Version Path
authpds-1.1.2 lib/authpds/acts_as_authentic/expiration.rb
authpds-1.1.1 lib/authpds/acts_as_authentic/expiration.rb
authpds-1.1.0 lib/authpds/acts_as_authentic/expiration.rb
authpds-1.0.0 lib/authpds/acts_as_authentic/expiration.rb
authpds-0.2.9 lib/authpds/acts_as_authentic/expiration.rb
authpds-0.2.8 lib/authpds/acts_as_authentic/expiration.rb
authpds-0.2.7 lib/authpds/acts_as_authentic/expiration.rb
authpds-0.2.6 lib/authpds/acts_as_authentic/expiration.rb
authpds-0.2.5 lib/authpds/acts_as_authentic/expiration.rb
authpds-0.2.4 lib/authpds/acts_as_authentic/expiration.rb
authpds-0.2.3 lib/authpds/acts_as_authentic/expiration.rb
authpds-0.2.2 lib/authpds/acts_as_authentic/expiration.rb
authpds-0.2.1 lib/authpds/acts_as_authentic/expiration.rb