Method: Standings::Displayer#template

Defined in:
lib/standings/displayer.rb

#template(team) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/standings/displayer.rb', line 22

def template(team)
  output =
    "#{(team.position.to_s).ljust(3," ")} " \
    "#{team.played.to_s.ljust(3, " ")} " \
    "#{team.points.to_s.ljust(5, " ")}" \
    "#{team.wins.to_s.ljust(5, " ")}" \
    "#{team.draws.to_s.ljust(5, " ")}" \
    "#{team.losses.to_s.ljust(5, " ")}"

  if results.top?(team)
    output += team.name.green
  elsif results.middle?(team)
    output += team.name.light_blue
  elsif results.bottom?(team)
    output += team.name.red
  else
    output += team.name
  end
end