lib/mathy/console.rb in mathy-0.0.1 vs lib/mathy/console.rb in mathy-0.0.2
- old
+ new
@@ -12,17 +12,33 @@
def operation?(operations)
selection = prompt?("choose operation? #{operations.map(&:key).flatten}")
operations.find { |operation| operation.matches?(selection) }
end
+ def difficulty?
+ Difficulties::GradeTwo.new
+ end
+
+ def display_results(player, score, turns_played)
+ report ""
+ report "+++++++++++++++++++++++++++++++++++"
+ report "You got #{score}/#{turns_played}."
+ report "Good bye #{player.name}"
+ report "+++++++++++++++++++++++++++++++++++"
+ end
+
def prompt?(question)
- puts question
+ report question
gets.strip
end
+ def report(message)
+ puts message
+ end
+
private
def clear_screen
- puts "\e[H\e[2J"
+ report "\e[H\e[2J"
end
end
end