Module: Expirable

Extended by:
ActiveSupport::Concern
Included in:
DeployToken, GroupGroupLink, Key, Member, PersonalAccessToken, ProjectGroupLink
Defined in:
app/models/concerns/expirable.rb

Constant Summary collapse

DAYS_TO_EXPIRE =
7

Instance Method Summary collapse

Instance Method Details

#expired?Boolean

Returns:

  • (Boolean)

12
13
14
# File 'app/models/concerns/expirable.rb', line 12

def expired?
  expires? && expires_at <= Time.current
end

#expires?Boolean

Returns:

  • (Boolean)

16
17
18
# File 'app/models/concerns/expirable.rb', line 16

def expires?
  expires_at.present?
end

#expires_soon?Boolean

Returns:

  • (Boolean)

20
21
22
# File 'app/models/concerns/expirable.rb', line 20

def expires_soon?
  expires? && expires_at < DAYS_TO_EXPIRE.days.from_now
end