Class: TrueOrFalse

Inherits:
Question show all
Defined in:
lib/Exam/trueorfalse.rb

Overview

Clase de gestion de preguntar True or False.

Instance Attribute Summary

Attributes inherited from Question

#difficulty, #qt, #r1, #wrong

Instance Method Summary collapse

Methods inherited from Question

#<=>, #==, #to_s

Constructor Details

#initialize(args) ⇒ TrueOrFalse

Inicializacion de la isntancia de la clase TrueOrFalse al cual se le pasa un texto para la pregunta y un booleano para la respuesta.

Raises:

  • (ArgumentError)


8
9
10
11
12
13
14
# File 'lib/Exam/trueorfalse.rb', line 8

def initialize (args)
	raise ArgumentError,"Se esperaba una pregunta" unless args.key?(:qt)
	raise ArgumentError,"Se esperaba la pregunta correcta" unless args.key?(:r1)
	args[:r1] = (args[:r1] ? "Cierto" : "Falso")
	args[:wrong] = [(args[:r1] ? "Falso" : "Cierto")]
	super(args)
end