lib/mathy/verification.rb in mathy-0.0.1 vs lib/mathy/verification.rb in mathy-0.0.2
- old
+ new
@@ -1,15 +1,19 @@
module Mathy
class Verification
+ def initialize(console)
+ @console = console
+ end
+
def check_answer(question, correct_answer)
- puts ""
- print question
+ @console.report ""
+ @console.report question
answer = gets
if answer.to_i == correct_answer
- print "Correct!"
+ @console.report "Correct!"
return true
end
- print "The correct answer is #{correct_answer}."
+ @console.report "The correct answer is #{correct_answer}."
false
end
end
end