Class: Covered::Statistics
- 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.
Attributes inherited from Wrapper
Instance Method Summary collapse
- #<<(coverage) ⇒ Object
-
#initialize ⇒ Statistics
constructor
A new instance of Statistics.
- #print(output) ⇒ Object
Methods included from Ratio
#complete?, #percentage, #ratio
Methods inherited from Wrapper
#accept?, #disable, #each, #enable, #expand_path, #mark, #relative_path, #to_h
Methods inherited from Base
#accept?, #disable, #each, #enable, #expand_path, #mark, #relative_path
Constructor Details
#initialize ⇒ Statistics
Returns a new instance of Statistics.
26 27 28 29 30 |
# File 'lib/covered/statistics.rb', line 26 def initialize @count = 0 @executable_count = 0 @executed_count = 0 end |
Instance Attribute Details
#count ⇒ Object (readonly)
Total number of files added.
33 34 35 |
# File 'lib/covered/statistics.rb', line 33 def count @count end |
#executable_count ⇒ Object (readonly)
The number of lines which could have been executed.
36 37 38 |
# File 'lib/covered/statistics.rb', line 36 def executable_count @executable_count end |
#executed_count ⇒ Object (readonly)
The number of lines that were executed.
39 40 41 |
# File 'lib/covered/statistics.rb', line 39 def executed_count @executed_count end |
Instance Method Details
#<<(coverage) ⇒ Object
41 42 43 44 45 |
# File 'lib/covered/statistics.rb', line 41 def << coverage @count += 1 @executable_count += coverage.executable_count @executed_count += coverage.executed_count end |
#print(output) ⇒ Object
49 50 51 52 53 |
# File 'lib/covered/statistics.rb', line 49 def print(output) output.puts "* #{count} files checked; #{executed_count}/#{executable_count} lines executed; #{percentage.to_f.round(2)}% covered." # Could output funny message here, especially for 100% coverage. end |