Class: Exam::Interfaz

Inherits:
Object
  • Object
show all
Defined in:
lib/exam/interfaz.rb

Overview

create a Interfaz

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(e) ⇒ Interfaz

Returns a new instance of Interfaz.



7
8
9
# File 'lib/exam/interfaz.rb', line 7

def initialize(e)
  @examen = e
end

Instance Attribute Details

#examenObject

Returns the value of attribute examen.



5
6
7
# File 'lib/exam/interfaz.rb', line 5

def examen
  @examen
end

Instance Method Details

#examinarObject



24
25
26
27
# File 'lib/exam/interfaz.rb', line 24

def examinar
  mostrar
  responder
end

#invertir_examenObject



29
30
31
# File 'lib/exam/interfaz.rb', line 29

def invertir_examen
  @examen.invertir
end

#mostrarObject



11
12
13
# File 'lib/exam/interfaz.rb', line 11

def mostrar
  puts @examen.to_s
end

#responderObject



15
16
17
18
19
20
21
22
# File 'lib/exam/interfaz.rb', line 15

def responder
  a=[]
  for i in 0..@examen.size-1
    puts "Respuesta a la pregunta #{i+1}: "
    a=a+[gets.chomp]
  end
  @examen.check_exam(a)
end