Class: Codebreaker::Console
- Inherits:
-
Object
- Object
- Codebreaker::Console
- Includes:
- Message
- Defined in:
- lib/codebreaker/console.rb
Constant Summary collapse
- HINT =
'-h'.freeze
- YES =
'y'.freeze
- EMPTY_INPUT =
''.freeze
Instance Attribute Summary collapse
-
#game ⇒ Object
readonly
Returns the value of attribute game.
-
#scores ⇒ Object
readonly
Returns the value of attribute scores.
-
#storage_path ⇒ Object
readonly
Returns the value of attribute storage_path.
Instance Method Summary collapse
- #erase_scores ⇒ Object
-
#initialize(game = DEMO) ⇒ Console
constructor
A new instance of Console.
- #start_game ⇒ Object
Methods included from Message
Constructor Details
#initialize(game = DEMO) ⇒ Console
Returns a new instance of Console.
16 17 18 19 20 |
# File 'lib/codebreaker/console.rb', line 16 def initialize(game = DEMO) @locale = Localization.new(:console) load_console(game) start_game if game == DEMO end |
Instance Attribute Details
#game ⇒ Object (readonly)
Returns the value of attribute game.
14 15 16 |
# File 'lib/codebreaker/console.rb', line 14 def game @game end |
#scores ⇒ Object (readonly)
Returns the value of attribute scores.
14 15 16 |
# File 'lib/codebreaker/console.rb', line 14 def scores @scores end |
#storage_path ⇒ Object (readonly)
Returns the value of attribute storage_path.
14 15 16 |
# File 'lib/codebreaker/console.rb', line 14 def storage_path @storage_path end |
Instance Method Details
#erase_scores ⇒ Object
28 29 30 31 32 |
# File 'lib/codebreaker/console.rb', line 28 def erase_scores print ['alerts']['erase_scores'] erase_game_data if input_selector exit_console end |
#start_game ⇒ Object
22 23 24 25 26 |
# File 'lib/codebreaker/console.rb', line 22 def start_game puts ['alerts']['welcome'].colorize(:background => :blue) puts ['alerts']['hint_info'] submit_answer end |