Class: Booth::Models::Contest

Inherits:
ApplicationRecord show all
Defined in:
lib/booth/models/contest.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.lifespanObject



20
21
22
# File 'lib/booth/models/contest.rb', line 20

def self.lifespan
  ::Booth.config.interaction_timeout
end

Instance Method Details

#formatted_codeObject



24
25
26
# File 'lib/booth/models/contest.rb', line 24

def formatted_code
  code.to_s.scan(/.{1,3}/).join(' ').presence
end

#lifespanObject



36
37
38
# File 'lib/booth/models/contest.rb', line 36

def lifespan
  self.class.lifespan
end

#recently_created?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/booth/models/contest.rb', line 28

def recently_created?
  ::Booth::Models::Contests::Scopes::RecentlyCreated.call(self)
end

#recently_responded?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/booth/models/contest.rb', line 32

def recently_responded?
  ::Booth::Models::Contests::Scopes::RecentlyResponded.call(self)
end