Class: Codebreaker::Console
- Inherits:
-
Object
- Object
- Codebreaker::Console
- Includes:
- Database
- Defined in:
- lib/entities/console.rb
Constant Summary collapse
- USER_ACTIONS =
{ start: 'start', rules: 'rules', stats: 'stats', leave: 'exit' }.freeze
- ACTIONS_FOR_DATABASE =
{ save_player: 'y' }.freeze
Constants included from Database
Database::FILE_PATH, Database::FOLDER_PATH, Database::FORMAT_PATH, Database::PATH
Instance Method Summary collapse
Methods included from Database
Instance Method Details
#choose_action ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/entities/console.rb', line 14 def choose_action respondent.(:greeting) loop do respondent.(:choose_action) case input when USER_ACTIONS[:start] then return process when USER_ACTIONS[:rules] then rules.show_rules when USER_ACTIONS[:stats] then show_statistics else respondent.(:wrong_input_action) end end end |