Class: R19Cov::Coverage::Summary
- Inherits:
-
Object
- Object
- R19Cov::Coverage::Summary
- Defined in:
- lib/r19cov/coverage/summary.rb
Instance Attribute Summary collapse
-
#code_coverage ⇒ Object
readonly
Returns the value of attribute code_coverage.
-
#coverages ⇒ Object
readonly
Returns the value of attribute coverages.
Instance Method Summary collapse
- #covered ⇒ Object
- #filename ⇒ Object
-
#initialize(coverages) ⇒ Summary
constructor
A new instance of Summary.
- #lines_of_code ⇒ Object
- #total_coverage ⇒ Object
- #total_lines ⇒ Object
- #uncovered ⇒ Object
Constructor Details
#initialize(coverages) ⇒ Summary
Returns a new instance of Summary.
6 7 8 |
# File 'lib/r19cov/coverage/summary.rb', line 6 def initialize(coverages) @coverages = coverages end |
Instance Attribute Details
#code_coverage ⇒ Object (readonly)
Returns the value of attribute code_coverage.
10 11 12 |
# File 'lib/r19cov/coverage/summary.rb', line 10 def code_coverage @code_coverage end |
#coverages ⇒ Object (readonly)
Returns the value of attribute coverages.
10 11 12 |
# File 'lib/r19cov/coverage/summary.rb', line 10 def coverages @coverages end |
Instance Method Details
#covered ⇒ Object
32 33 34 |
# File 'lib/r19cov/coverage/summary.rb', line 32 def covered coverages.inject(0){ |t, c| t += c.covered } end |
#filename ⇒ Object
12 13 14 |
# File 'lib/r19cov/coverage/summary.rb', line 12 def filename 'index' end |
#lines_of_code ⇒ Object
20 21 22 |
# File 'lib/r19cov/coverage/summary.rb', line 20 def lines_of_code coverages.inject(0){ |t, c| t += c.lines_of_code } end |
#total_coverage ⇒ Object
24 25 26 |
# File 'lib/r19cov/coverage/summary.rb', line 24 def total_coverage total_lines > 0 ? (total_lines.to_f - uncovered.to_f) / total_lines.to_f : 0.0 end |
#total_lines ⇒ Object
16 17 18 |
# File 'lib/r19cov/coverage/summary.rb', line 16 def total_lines coverages.inject(0){ |t, c| t += c.total_lines } end |
#uncovered ⇒ Object
36 37 38 |
# File 'lib/r19cov/coverage/summary.rb', line 36 def uncovered coverages.inject(0){ |t, c| t += c.uncovered } end |