Sha256: 66310e502aa7b3fcda4c70a9c3d523202f69f1707d9bce2e1421e25a3a449c23

Contents?: true

Size: 503 Bytes

Versions: 1

Compression:

Stored size: 503 Bytes

Contents

module Doorkeeper
  module Models
    module Expirable
      def expired?
        expires_in && Time.now > expired_time
      end

      def expired_time
        created_at + expires_in.seconds
      end

      def expires_in_seconds
        return nil if expires_in.nil?
        expires = (created_at + expires_in.seconds) - Time.now
        expires_sec = expires.seconds.round(0)
        expires_sec > 0 ? expires_sec : 0  
      end
      private :expired_time
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
couchkeeper-0.6.7 lib/doorkeeper/models/expirable.rb