Sha256: 4a2ef2d63c87160353bb0060c1ff5493fdd3f5af661e1b07b49acced79792d31
Contents?: true
Size: 873 Bytes
Versions: 3
Compression:
Stored size: 873 Bytes
Contents
class Assumption::CLI include UniFunctions attr_accessor :input def start_sequence clear_terminal title self.begin end def begin puts 'Type the chart year you would like to play between 1954-2019' year_input puts 'Would you like to play again? (y/n)' get_char @input == 'y' ? start_sequence : exit end private def year_input @input = gets #binding.pry if (1954..2019).include?(@input.to_i) Assumption::Game.new(@input.to_i) elsif @input.strip == "random" Assumption::Game.new(random_year) elsif @input.strip.to_s.size != 4 puts 'Must be 4 digits' year_input elsif !(1954..2019).include?(@input.to_i) puts 'Must be within 1954-2019' year_input else puts 'Error' exit end end def random_year rand(1954..2019) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
assumption-0.2.1 | lib/assumption/cli.rb |
assumption-0.2.0 | lib/assumption/cli.rb |
assumption-0.1.0 | lib/assumption/cli.rb |