Sha256: eddefa94a71ceeac568614942c52c3ebffedca0e105f8c5c495774857af2c547
Contents?: true
Size: 530 Bytes
Versions: 1
Compression:
Stored size: 530 Bytes
Contents
module Mathy class Console def greet clear_screen prompt?('what is your name?') end def how_many_turns? prompt?("how many questions do you want?").to_i end def operation?(operations) selection = prompt?("choose operation? #{operations.map(&:key).flatten}") operations.find { |operation| operation.matches?(selection) } end def prompt?(question) puts question gets.strip end private def clear_screen puts "\e[H\e[2J" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mathy-0.0.1 | lib/mathy/console.rb |