Class: Codebreaker::Console
- Inherits:
-
Object
- Object
- Codebreaker::Console
- Defined in:
- lib/codebreaker/console.rb
Constant Summary collapse
- COMMAND =
{ start: '1', rules: '2', stats: '3', quit: 'q', use_tip: 'h', yes: 'y', no: 'n' }.freeze
Instance Attribute Summary collapse
-
#game ⇒ Object
readonly
Returns the value of attribute game.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
Instance Attribute Details
#game ⇒ Object (readonly)
Returns the value of attribute game.
6 7 8 |
# File 'lib/codebreaker/console.rb', line 6 def game @game end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
6 7 8 |
# File 'lib/codebreaker/console.rb', line 6 def user @user end |
Instance Method Details
#menu ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/codebreaker/console.rb', line 8 def show(:INTRO) loop do show(:MAIN_MENU, start: COMMAND[:start], rules: COMMAND[:rules], stats: COMMAND[:stats], quit: COMMAND[:quit]) case input when COMMAND[:start] then pre_game_process when COMMAND[:rules] then show(:RULES) when COMMAND[:stats] then show_stats else show(:MENU_ERROR) end end end |