Class: Xcov::Report
Instance Attribute Summary collapse
-
#coverage ⇒ Object
Returns the value of attribute coverage.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#target_templates ⇒ Object
Returns the value of attribute target_templates.
-
#targets ⇒ Object
Returns the value of attribute targets.
Attributes inherited from Base
#coverage_color, #displayable_coverage, #id, #name
Class Method Summary collapse
-
.map(dictionary) ⇒ Object
Class methods.
Instance Method Summary collapse
- #average_coverage(targets) ⇒ Object
- #html_value ⇒ Object
-
#initialize(targets) ⇒ Report
constructor
A new instance of Report.
- #print_description ⇒ Object
Methods inherited from Base
#create_coverage_color, #create_displayable_coverage, #create_summary, template
Constructor Details
#initialize(targets) ⇒ Report
Returns a new instance of Report.
10 11 12 13 14 15 16 |
# File 'lib/xcov/model/report.rb', line 10 def initialize (targets) @targets = targets @coverage = average_coverage(targets) @displayable_coverage = self.create_displayable_coverage @coverage_color = self.create_coverage_color @summary = self.create_summary end |
Instance Attribute Details
#coverage ⇒ Object
Returns the value of attribute coverage.
5 6 7 |
# File 'lib/xcov/model/report.rb', line 5 def coverage @coverage end |
#summary ⇒ Object
Returns the value of attribute summary.
7 8 9 |
# File 'lib/xcov/model/report.rb', line 7 def summary @summary end |
#target_templates ⇒ Object
Returns the value of attribute target_templates.
8 9 10 |
# File 'lib/xcov/model/report.rb', line 8 def target_templates @target_templates end |
#targets ⇒ Object
Returns the value of attribute targets.
6 7 8 |
# File 'lib/xcov/model/report.rb', line 6 def targets @targets end |
Class Method Details
Instance Method Details
#average_coverage(targets) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/xcov/model/report.rb', line 18 def average_coverage targets coverage = 0 targets.each do |target| coverage = coverage + target.coverage end coverage / targets.count end |
#html_value ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/xcov/model/report.rb', line 33 def html_value @target_templates = "" @targets.each do |target| @target_templates << target.html_value end Function.template("report").result(binding) end |
#print_description ⇒ Object
26 27 28 29 30 31 |
# File 'lib/xcov/model/report.rb', line 26 def print_description puts "Total coverage: (#{@coverage})" @targets.each do |target| target.print_description end end |