Sha256: ce33f322a1ce88ce049a7c407d1b043c3a75c277a86a125625ce7fc77ecfa238
Contents?: true
Size: 737 Bytes
Versions: 3
Compression:
Stored size: 737 Bytes
Contents
module Exam # create a Test class Test include Comparable attr_accessor :pregunta, :correcta, :respuestas, :nivel def <=> (a) @nivel <=> a.nivel end def == (a) @pregunta==a.pregunta && @correcta==a.correcta && @respuestas.should =~ a.respuestas end def initialize(pregunta, correcta, respuestas, nivel=nil) @pregunta = pregunta @correcta = correcta @respuestas = respuestas.shuffle @nivel = nivel end def check_ans(c) return (c == @correcta) end def to_s texto = "Pregunta: #{@pregunta} \n" for i in 0..@respuestas.size-1 texto = texto + "\t #{i+1}) #{@respuestas[i]} \n" end return texto end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
exam_LPP_T_5-0.1.4 | lib/exam/test.rb |
exam_LPP_T_5-0.1.3 | lib/exam/test.rb |
exam_LPP_T_5-0.1.2 | lib/exam/test.rb |