Class: Barker::CandidateRound

Inherits:
Object
  • Object
show all
Defined in:
lib/barker/candidate_round.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(candidate, round, options = {}) ⇒ CandidateRound

Returns a new instance of CandidateRound.



5
6
7
8
9
10
# File 'lib/barker/candidate_round.rb', line 5

def initialize(candidate, round, options = {})
  @candidate = candidate
  @round = round
  @guideline = options[:guideline]
  @timer = guideline.try(:round_time)
end

Instance Attribute Details

#candidateObject (readonly)

Returns the value of attribute candidate.



3
4
5
# File 'lib/barker/candidate_round.rb', line 3

def candidate
  @candidate
end

#guidelineObject (readonly)

Returns the value of attribute guideline.



3
4
5
# File 'lib/barker/candidate_round.rb', line 3

def guideline
  @guideline
end

#roundObject (readonly)

Returns the value of attribute round.



3
4
5
# File 'lib/barker/candidate_round.rb', line 3

def round
  @round
end

#timerObject (readonly)

Returns the value of attribute timer.



3
4
5
# File 'lib/barker/candidate_round.rb', line 3

def timer
  @timer
end

Instance Method Details

#answer(answer_id) ⇒ Object



20
21
22
# File 'lib/barker/candidate_round.rb', line 20

def answer(answer_id)
  question.answer(answer_id)
end

#ask(options = {}) ⇒ Object



16
17
18
# File 'lib/barker/candidate_round.rb', line 16

def ask(options = {})
  question.ask(options)
end

#given_answerObject



24
25
26
# File 'lib/barker/candidate_round.rb', line 24

def given_answer
  question.given_answer
end

#joker(joker) ⇒ Object



28
29
30
# File 'lib/barker/candidate_round.rb', line 28

def joker(joker)
  question.joker(joker)
end

#questionObject



12
13
14
# File 'lib/barker/candidate_round.rb', line 12

def question
  @question ||= CandidateQuestion.new(candidate, round.question, :timer => timer)
end