Module: Output
Instance Method Summary collapse
- #generate_table_titles ⇒ Object
- #generate_table_values(sorted_stats) ⇒ Object
- #show_main_menu ⇒ Object
- #show_msg(type) ⇒ Object
- #show_rules ⇒ Object
- #show_stats(sorted_stats = Statistic.sort_stats) ⇒ Object
- #show_welcome ⇒ Object
Instance Method Details
#generate_table_titles ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/modules/output.rb', line 23 def generate_table_titles row do column('Player name', width: 20) column('Difficulty', width: 10) column('Attempts total', width: 14) column('Attempts used', width: 13) column('Hints total', width: 11) column('Hints used', width: 11) end end |
#generate_table_values(sorted_stats) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/modules/output.rb', line 34 def generate_table_values(sorted_stats) sorted_stats.each do |player| row do column(player[:name]) column(player[:difficulty]) column(player[:total_attempts]) column(player[:used_attempts]) column(player[:total_hints]) column(player[:used_hints]) end end end |
#show_main_menu ⇒ Object
8 9 10 |
# File 'lib/modules/output.rb', line 8 def show_msg(:MainMenu) end |
#show_msg(type) ⇒ Object
47 48 49 |
# File 'lib/modules/output.rb', line 47 def show_msg(type) puts I18n.t(type) end |
#show_rules ⇒ Object
12 13 14 |
# File 'lib/modules/output.rb', line 12 def show_rules show_msg(:Rules) end |
#show_stats(sorted_stats = Statistic.sort_stats) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/modules/output.rb', line 16 def show_stats(sorted_stats = Statistic.sort_stats) table(border: true) do generate_table_titles generate_table_values(sorted_stats) end end |
#show_welcome ⇒ Object
4 5 6 |
# File 'lib/modules/output.rb', line 4 def show_welcome show_msg(:Welcome) end |