Sha256: cdc098afdfd4d5d07c18decb1e9d9b9f34c91e47ec1caaa3074d9cbedc4ca0f8

Contents?: true

Size: 579 Bytes

Versions: 4

Compression:

Stored size: 579 Bytes

Contents

# frozen_string_literal: true

module Doorkeeper
  module Models
    module Revocable
      # Revokes the object (updates `:revoked_at` attribute setting its value
      # to the specific time).
      #
      # @param clock [Time] time object
      #
      def revoke(clock = Time)
        update_attribute :revoked_at, clock.now.utc
      end

      # Indicates whether the object has been revoked.
      #
      # @return [Boolean] true if revoked, false in other case
      #
      def revoked?
        !!(revoked_at && revoked_at <= Time.now.utc)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
doorkeeper-5.3.3 lib/doorkeeper/models/concerns/revocable.rb
doorkeeper-5.3.2 lib/doorkeeper/models/concerns/revocable.rb
doorkeeper-5.3.1 lib/doorkeeper/models/concerns/revocable.rb
doorkeeper-5.3.0 lib/doorkeeper/models/concerns/revocable.rb