Class: Output::Messages
- Inherits:
-
Object
- Object
- Output::Messages
- Defined in:
- lib/console_app/output.rb
Constant Summary collapse
- ARROW =
'~> '.freeze
Class Method Summary collapse
- .clear ⇒ Object
- .difficult_error ⇒ Object
- .game_commands ⇒ Object
- .get_hint(game) ⇒ Object
- .hint_error ⇒ Object
- .lose ⇒ Object
- .name_error ⇒ Object
- .save_stats ⇒ Object
- .show_bye ⇒ Object
- .show_difficult ⇒ Object
- .show_game_info(game) ⇒ Object
- .show_greeting ⇒ Object
- .show_name ⇒ Object
- .show_rules ⇒ Object
- .show_stats(stat) ⇒ Object
- .start_again ⇒ Object
- .stats_error ⇒ Object
- .unknown_command ⇒ Object
- .win ⇒ Object
Class Method Details
.clear ⇒ Object
6 7 8 |
# File 'lib/console_app/output.rb', line 6 def clear system('clear') end |
.difficult_error ⇒ Object
85 86 87 |
# File 'lib/console_app/output.rb', line 85 def difficult_error puts I18n.t :difficult_error end |
.game_commands ⇒ Object
59 60 61 |
# File 'lib/console_app/output.rb', line 59 def game_commands puts I18n.t :game_commands end |
.get_hint(game) ⇒ Object
42 43 44 45 46 |
# File 'lib/console_app/output.rb', line 42 def get_hint(game) return Messages.hint_error if game.hints.zero? puts "[#{game.use_hint}] - one of the number" end |
.hint_error ⇒ Object
89 90 91 |
# File 'lib/console_app/output.rb', line 89 def hint_error puts I18n.t :hint_error end |
.lose ⇒ Object
81 82 83 |
# File 'lib/console_app/output.rb', line 81 def lose puts I18n.t :lose end |
.name_error ⇒ Object
77 78 79 |
# File 'lib/console_app/output.rb', line 77 def name_error puts I18n.t :name_error end |
.save_stats ⇒ Object
72 73 74 75 |
# File 'lib/console_app/output.rb', line 72 def save_stats puts I18n.t :save_stats print ARROW end |
.show_bye ⇒ Object
30 31 32 |
# File 'lib/console_app/output.rb', line 30 def show_bye puts I18n.t :goodbye end |
.show_difficult ⇒ Object
48 49 50 51 52 |
# File 'lib/console_app/output.rb', line 48 def show_difficult puts I18n.t :set_difficult puts I18n.t :difficult print ARROW end |
.show_game_info(game) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/console_app/output.rb', line 34 def show_game_info(game) puts '===================' puts I18n.t(:game_hints, hints: game.hints) puts I18n.t(:game_attempts, attempts: game.attempts) puts I18n.t :game_help print ARROW end |
.show_greeting ⇒ Object
20 21 22 23 24 |
# File 'lib/console_app/output.rb', line 20 def show_greeting clear puts I18n.t :greeting puts I18n.t :menu end |
.show_name ⇒ Object
54 55 56 57 |
# File 'lib/console_app/output.rb', line 54 def show_name puts I18n.t :set_name print ARROW end |
.show_rules ⇒ Object
26 27 28 |
# File 'lib/console_app/output.rb', line 26 def show_rules puts I18n.t :rules end |
.show_stats(stat) ⇒ Object
14 15 16 17 18 |
# File 'lib/console_app/output.rb', line 14 def show_stats(stat) puts I18n.t(:show_stats, rating: stat[:rating], name: stat[:name], difficult: stat[:difficult].level, a: (stat[:attempts] + stat[:attempts_used]), a_used: stat[:attempts_used], h: (stat[:hints] + stat[:hints_used]), h_used: stat[:hints_used]) end |
.start_again ⇒ Object
63 64 65 66 |
# File 'lib/console_app/output.rb', line 63 def start_again puts I18n.t :start_again print ARROW end |
.stats_error ⇒ Object
10 11 12 |
# File 'lib/console_app/output.rb', line 10 def stats_error puts I18n.t :stats_error end |
.unknown_command ⇒ Object
93 94 95 |
# File 'lib/console_app/output.rb', line 93 def unknown_command puts I18n.t :unknown_command end |
.win ⇒ Object
68 69 70 |
# File 'lib/console_app/output.rb', line 68 def win puts I18n.t :win end |