Class: Quiz
- Inherits:
-
Object
- Object
- Quiz
- Defined in:
- lib/exam/quiz.rb
Instance Method Summary collapse
-
#initialize(&block) ⇒ Quiz
constructor
A new instance of Quiz.
- #questionS(pregunta, respuesta = {}) ⇒ Object
- #questionVF(pregunta, respuesta) ⇒ Object
- #to_s ⇒ Object
Constructor Details
Instance Method Details
#questionS(pregunta, respuesta = {}) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/exam/quiz.rb', line 21 def questionS (pregunta, respuesta = {}) preg = PreguntaS.new(pregunta) count = 1 respuesta.each do |key, val| preg.addr(val) if key count += 1 else preg.correcta = count end end @lista.addn(preg) end |
#questionVF(pregunta, respuesta) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/exam/quiz.rb', line 36 def questionVF (pregunta, respuesta) preg = PreguntaVF.new(pregunta) preg.correcta = respuesta @lista.addn(preg) end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/exam/quiz.rb', line 17 def to_s @examen.to_s end |