Sha256: d6291863c22c339befbd755d47d7678b16f681b68e9ed6488d0c559e5a64c2f8
Contents?: true
Size: 568 Bytes
Versions: 1
Compression:
Stored size: 568 Bytes
Contents
require_relative "./answer.rb" class Question ORDER = 0 KIND = 1 attr_accessor :text, :answers def initialize(text, answers) @text = text #Primero posición de la respuesta en el examen, luego si es correcta o incorrecta y por último la respuesta. @answers = answers.map { |k, v| Answer.new(k[ORDER], k[KIND], v) }.sort end def check(answerUser) @answers[answerUser -1].is_right? end def to_s cadena = @text + "\n" @answers.each do |answer| cadena << " #{answer}\n" end cadena end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
estefania_exam-0.0.2 | lib/quiz/question.rb |