Class: Covered::Statistics::Aggregate
- Inherits:
-
Object
- Object
- Covered::Statistics::Aggregate
- Includes:
- Ratio
- Defined in:
- lib/covered/statistics.rb
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
- #as_json ⇒ Object
-
#initialize ⇒ Aggregate
constructor
A new instance of Aggregate.
- #to_json(options) ⇒ Object
Methods included from Ratio
#complete?, #percentage, #ratio
Constructor Details
#initialize ⇒ Aggregate
Returns a new instance of Aggregate.
25 26 27 28 29 |
# File 'lib/covered/statistics.rb', line 25 def initialize @count = 0 @executable_count = 0 @executed_count = 0 end |
Instance Attribute Details
#count ⇒ Object (readonly)
Total number of files added.
32 33 34 |
# File 'lib/covered/statistics.rb', line 32 def count @count end |
#executable_count ⇒ Object (readonly)
The number of lines which could have been executed.
35 36 37 |
# File 'lib/covered/statistics.rb', line 35 def executable_count @executable_count end |
#executed_count ⇒ Object (readonly)
The number of lines that were executed.
38 39 40 |
# File 'lib/covered/statistics.rb', line 38 def executed_count @executed_count end |
Instance Method Details
#<<(coverage) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/covered/statistics.rb', line 53 def << coverage @count += 1 @executable_count += coverage.executable_count @executed_count += coverage.executed_count end |
#as_json ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/covered/statistics.rb', line 40 def as_json { count: count, executable_count: executable_count, executed_count: executed_count, percentage: percentage.to_f.round(2), } end |
#to_json(options) ⇒ Object
49 50 51 |
# File 'lib/covered/statistics.rb', line 49 def to_json() as_json.to_json() end |