Class: Displayer
- Inherits:
-
Object
- Object
- Displayer
- Defined in:
- lib/displayer.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
3 4 5 |
# File 'lib/displayer.rb', line 3 def call display_table end |
#dashes_for_display_table ⇒ Object
29 30 31 32 |
# File 'lib/displayer.rb', line 29 def dashes_for_display_table # draw enough dashes so that teams with long names are still covered by the dashes. Given a team length integer, add it to 17 (the length of the static puts statement in #display_table) "-" * (17 + Team.get_longest_team_name_length) end |
#display_table ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/displayer.rb', line 21 def display_table puts dashes_for_display_table puts "# P Pts Team" puts dashes_for_display_table Team::teams.each { |team| puts template(team); sleep 0.01 } puts dashes_for_display_table end |
#template(team) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/displayer.rb', line 7 def template(team) output = "#{(team.position).ljust(3," ")} #{team.played.ljust(3, " ")} #{team.points.to_s.ljust(5, " ")}" if team.top? output += team.name.green elsif team.middle? output += team.name.light_blue elsif team.bottom? output += team.name.red else output += team.name end end |