Class: Console
- Inherits:
-
Object
- Object
- Console
- Includes:
- Codebreaker, Database, Output
- Defined in:
- lib/console_app/console.rb
Constant Summary collapse
- COMMANDS =
{ start: 'start', rules: 'rules', stats: 'stats', exit: 'exit', hints: 'hints' }.freeze
- YES =
'y'.freeze
Constants included from Codebreaker
Constants included from Codebreaker::Validation
Codebreaker::Validation::VALID_DIFFICULTS
Instance Method Summary collapse
Methods included from Codebreaker::Validation
#difficult_valid?, #guess_valid?, #name_valid?
Instance Method Details
#run ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/console_app/console.rb', line 16 def run Messages.show_greeting loop do case gets.chomp.downcase when COMMANDS[:start] then return register when COMMANDS[:rules] then Messages.show_rules when COMMANDS[:stats] then Statistics.show when COMMANDS[:exit] then close else Messages.unknown_command end end end |