Class: Corundum::QA::ReportFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/corundum/qa-report.rb

Overview

Adopted gratefully from Xavier Shay’s Cane

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reports) ⇒ ReportFormatter

Returns a new instance of ReportFormatter.



7
8
9
# File 'lib/corundum/qa-report.rb', line 7

def initialize(reports)
  @reports = reports
end

Instance Attribute Details

#reportsObject (readonly)

Returns the value of attribute reports.



10
11
12
# File 'lib/corundum/qa-report.rb', line 10

def reports
  @reports
end

Instance Method Details

#to_sObject



12
13
14
15
16
17
18
19
20
# File 'lib/corundum/qa-report.rb', line 12

def to_s
  return "" if reports.empty?

  widths = column_widths(reports)

  reports.map do |report|
    report.to_s(widths)
  end.join("\n") + "\n\n" + totals + "\n\n"
end