Class: Examen::Pregunta
- Inherits:
-
Object
- Object
- Examen::Pregunta
- Includes:
- Comparable
- Defined in:
- lib/examen/pregunta.rb
Overview
< Struct.new(“Pregunta”, :enunciado , :respuesta, :falsas)
Direct Known Subclasses
Instance Attribute Summary collapse
-
#enunciado ⇒ Object
readonly
use a class to define behavior, together with a Struct that defines the data to which the class should be initialized.
-
#falsas ⇒ Object
readonly
use a class to define behavior, together with a Struct that defines the data to which the class should be initialized.
-
#respuesta ⇒ Object
readonly
use a class to define behavior, together with a Struct that defines the data to which the class should be initialized.
-
#valor ⇒ Object
readonly
use a class to define behavior, together with a Struct that defines the data to which the class should be initialized.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #extresp ⇒ Object
-
#initialize(arg) ⇒ Pregunta
constructor
A new instance of Pregunta.
- #preg ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(arg) ⇒ Pregunta
Returns a new instance of Pregunta.
21 22 23 24 25 26 |
# File 'lib/examen/pregunta.rb', line 21 def initialize(arg) @valor=arg[:valor] @enunciado=arg[:enunciado] @respuesta=arg[:respuesta] @falsas=arg[:falsas] end |
Instance Attribute Details
#enunciado ⇒ Object (readonly)
use a class to define behavior, together with a Struct that defines the data to which the class should be initialized.
Mas general una clase pregunta y que eleccion simple y verdader falso hereden de ella, en pregunta instancear variable ‘ponderacion’ que permita comprar el nivel de dificultad entre dos preguntas distintas
19 20 21 |
# File 'lib/examen/pregunta.rb', line 19 def enunciado @enunciado end |
#falsas ⇒ Object (readonly)
use a class to define behavior, together with a Struct that defines the data to which the class should be initialized.
Mas general una clase pregunta y que eleccion simple y verdader falso hereden de ella, en pregunta instancear variable ‘ponderacion’ que permita comprar el nivel de dificultad entre dos preguntas distintas
19 20 21 |
# File 'lib/examen/pregunta.rb', line 19 def falsas @falsas end |
#respuesta ⇒ Object (readonly)
use a class to define behavior, together with a Struct that defines the data to which the class should be initialized.
Mas general una clase pregunta y que eleccion simple y verdader falso hereden de ella, en pregunta instancear variable ‘ponderacion’ que permita comprar el nivel de dificultad entre dos preguntas distintas
19 20 21 |
# File 'lib/examen/pregunta.rb', line 19 def respuesta @respuesta end |
#valor ⇒ Object (readonly)
use a class to define behavior, together with a Struct that defines the data to which the class should be initialized.
Mas general una clase pregunta y que eleccion simple y verdader falso hereden de ella, en pregunta instancear variable ‘ponderacion’ que permita comprar el nivel de dificultad entre dos preguntas distintas
19 20 21 |
# File 'lib/examen/pregunta.rb', line 19 def valor @valor end |
Instance Method Details
#<=>(other) ⇒ Object
44 45 46 47 |
# File 'lib/examen/pregunta.rb', line 44 def <=> other #return nil unless other.is_a? Examen self.valor <=> other.valor end |
#extresp ⇒ Object
29 30 31 32 33 |
# File 'lib/examen/pregunta.rb', line 29 def extresp "RESPUESTAS : #{@respuesta}, #{@falsas}" end |
#preg ⇒ Object
40 41 42 |
# File 'lib/examen/pregunta.rb', line 40 def preg "PREGUNTA : #{@enunciado}" end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/examen/pregunta.rb', line 35 def to_s preg + extresp end |