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 Also known as: expired_original?

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)

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

def expires?
  expires_at.present?
end

#expires_soon?Boolean

Returns:

  • (Boolean)

23
24
25
# File 'app/models/concerns/expirable.rb', line 23

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