class Examen
Attributes
acierto[RW]
fallo[RW]
list[RW]
node_i[RW]
Public Class Methods
new(list)
click to toggle source
# File lib/exam/examen.rb, line 12 def initialize(list) @acierto = 0 @fallo = 0 @list = list end
Public Instance Methods
next_question()
click to toggle source
# File lib/exam/examen.rb, line 18 def next_question() if @node_i != nil then if @node_i.next != nil then @node_i = @node_i.next else return nil end else @node_i = @list.head end puts @node_i.value.to_s return @node_i.value.to_s end
response_question(value)
click to toggle source
# File lib/exam/examen.rb, line 35 def response_question(value) print "Respuesta: " if value == @node_i.value.right then puts "\n" puts "La pregunta es correcta" puts "\n" @acierto += 1 else puts "\n" puts "La pregunta es incorrecta" puts "\n" @fallo += 1 end end
reverse_question()
click to toggle source
# File lib/exam/examen.rb, line 32 def reverse_question @list.reverse end
show_stats()
click to toggle source
# File lib/exam/examen.rb, line 49 def show_stats puts "\n" puts "|---------------------------|" puts "|--- Estadisticas ---|" puts "|---------------------------|" puts "|- Aciertos: #{@acierto} | Fallos: #{@fallo} -|" puts "|---------------------------|" puts "\n" end