Method: Cloudcost::ServerList#totals

Defined in:
lib/cloudcost/commands/server/server_list.rb

#totals(servers = @servers) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/cloudcost/commands/server/server_list.rb', line 27

def totals(servers = @servers)
  totals = calculate_totals(servers)
  total_row = @options[:summary] ? %w[Total] : ["Total", "", "", ""]
  total_row.concat [
    totals[:vcpu],
    totals[:memory],
    totals[:ssd],
    totals[:bulk],
    format("%.2f", totals[:cost].round(2)),
    format("%.2f", (totals[:cost] * 30).round(2))
  ]
end