Sha256: 28ddb08ce6ddc051887f4ff6d86c48cc3fe04a6ef7a5179574bad5a3441be627

Contents?: true

Size: 577 Bytes

Versions: 3

Compression:

Stored size: 577 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_column(: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

3 entries across 3 versions & 1 rubygems

Version Path
doorkeeper-5.4.0 lib/doorkeeper/models/concerns/revocable.rb
doorkeeper-5.4.0.rc2 lib/doorkeeper/models/concerns/revocable.rb
doorkeeper-5.4.0.rc1 lib/doorkeeper/models/concerns/revocable.rb