Module: Doorkeeper::Models::Revocable
- Included in:
- AccessGrantMixin, AccessTokenMixin
- Defined in:
- lib/doorkeeper/models/concerns/revocable.rb
Instance Method Summary collapse
-
#revoke(clock = Time) ⇒ Object
Revokes the object (updates ‘:revoked_at` attribute setting its value to the specific time).
-
#revoked? ⇒ Boolean
Indicates whether the object has been revoked.
Instance Method Details
#revoke(clock = Time) ⇒ Object
Revokes the object (updates ‘:revoked_at` attribute setting its value to the specific time).
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/doorkeeper/models/concerns/revocable.rb', line 11 def revoke(clock = Time) return if revoked? # Wrap in with_primary_role if the model class supports it if self.class.respond_to?(:with_primary_role) self.class.with_primary_role { update_attribute(:revoked_at, clock.now.utc) } else update_attribute(:revoked_at, clock.now.utc) end end |
#revoked? ⇒ Boolean
Indicates whether the object has been revoked.
26 27 28 |
# File 'lib/doorkeeper/models/concerns/revocable.rb', line 26 def revoked? !!(revoked_at && revoked_at <= Time.now.utc) end |