Class: Pregunta

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/simpleselect/pregunta.rb

Overview

Clase que define una pregunta

Direct Known Subclasses

SimpleSelect, TorFalse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(preg, dif) ⇒ Pregunta

Returns a new instance of Pregunta.



9
10
11
12
# File 'lib/simpleselect/pregunta.rb', line 9

def initialize (preg, dif)
    @preg = preg
    @dif = dif
end

Instance Attribute Details

#difFixnum (readonly)

valoracion de la dificultad de la pregunta

Returns:

  • (Fixnum)

    the current value of dif



5
6
7
# File 'lib/simpleselect/pregunta.rb', line 5

def dif
  @dif
end

#pregstring (readonly)

almacena la pregunta

Returns:

  • (string)

    the current value of preg



5
6
7
# File 'lib/simpleselect/pregunta.rb', line 5

def preg
  @preg
end

Instance Method Details

#<=>(other) ⇒ Object



17
18
19
# File 'lib/simpleselect/pregunta.rb', line 17

def <=> (other)
    @dif <=> other.dif
end

#to_sObject



13
14
15
16
# File 'lib/simpleselect/pregunta.rb', line 13

def to_s
    aux = @preg + "\n"
    aux
end