Class: Covered::Statistics::Aggregate
- Inherits:
-
Object
- Object
- Covered::Statistics::Aggregate
- Includes:
- Ratio
- Defined in:
- lib/covered/statistics.rb
Overview
Aggregate coverage totals.
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Total number of files added.
-
#executable_count ⇒ Object
readonly
The number of lines which could have been executed.
-
#executed_count ⇒ Object
readonly
The number of lines that were executed.
Instance Method Summary collapse
-
#<<(coverage) ⇒ Object
Add coverage to these aggregate statistics.
-
#as_json ⇒ Object
A JSON-compatible representation of these aggregate statistics.
-
#initialize ⇒ Aggregate
constructor
Initialize empty aggregate statistics.
-
#to_json(options) ⇒ Object
Convert these aggregate statistics to JSON.
Methods included from Ratio
#complete?, #percentage, #ratio
Constructor Details
#initialize ⇒ Aggregate
Initialize empty aggregate statistics.
32 33 34 35 36 |
# File 'lib/covered/statistics.rb', line 32 def initialize @count = 0 @executable_count = 0 @executed_count = 0 end |
Instance Attribute Details
#count ⇒ Object (readonly)
Total number of files added.
40 41 42 |
# File 'lib/covered/statistics.rb', line 40 def count @count end |
#executable_count ⇒ Object (readonly)
The number of lines which could have been executed.
44 45 46 |
# File 'lib/covered/statistics.rb', line 44 def executable_count @executable_count end |
#executed_count ⇒ Object (readonly)
The number of lines that were executed.
48 49 50 |
# File 'lib/covered/statistics.rb', line 48 def executed_count @executed_count end |
Instance Method Details
#<<(coverage) ⇒ Object
Add coverage to these aggregate statistics.
70 71 72 73 74 75 |
# File 'lib/covered/statistics.rb', line 70 def << coverage @count += 1 @executable_count += coverage.executable_count @executed_count += coverage.executed_count end |
#as_json ⇒ Object
A JSON-compatible representation of these aggregate statistics.
52 53 54 55 56 57 58 59 |
# File 'lib/covered/statistics.rb', line 52 def as_json { count: count, executable_count: executable_count, executed_count: executed_count, percentage: percentage.to_f.round(2), } end |
#to_json(options) ⇒ Object
Convert these aggregate statistics to JSON.
64 65 66 |
# File 'lib/covered/statistics.rb', line 64 def to_json() as_json.to_json() end |