Class: Barker::CandidateAnswer

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(candidate, answer) ⇒ CandidateAnswer

Returns a new instance of CandidateAnswer.



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

def initialize(candidate, answer)
  @candidate = candidate
  @answer    = answer
  @revealed  = false
end

Instance Attribute Details

#answerObject

Returns the value of attribute answer.



4
5
6
# File 'lib/barker/candidate_answer.rb', line 4

def answer
  @answer
end

#candidateObject

Returns the value of attribute candidate.



4
5
6
# File 'lib/barker/candidate_answer.rb', line 4

def candidate
  @candidate
end

#reveal_answerObject

Returns the value of attribute reveal_answer.



4
5
6
# File 'lib/barker/candidate_answer.rb', line 4

def reveal_answer
  @reveal_answer
end

Instance Method Details

#answer_idObject Also known as: id



32
33
34
# File 'lib/barker/candidate_answer.rb', line 32

def answer_id
  answer.id
end

#candidate_idObject



37
38
39
# File 'lib/barker/candidate_answer.rb', line 37

def candidate_id
  candidate.id
end

#correct?Boolean

Returns:

  • (Boolean)


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

def correct?
  answer.correct?
end

#labelObject



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

def label
  answer.label[candidate.locale] || answer.label["en"]
end

#revealObject



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

def reveal
  @revealed = true
end

#revealed?Boolean

Returns:

  • (Boolean)


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

def revealed?
  @revealed
end

#valid?Boolean

Returns:

  • (Boolean)


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

def valid?
  answer.valid?
end