Module: Covered::Ratio
- Included in:
- Coverage, Statistics, Statistics::Aggregate
- Defined in:
- lib/covered/coverage.rb
Overview
Computes common coverage ratios from executed and executable line counts.
Instance Method Summary collapse
-
#complete? ⇒ Boolean
Whether all executable lines were executed.
-
#percentage ⇒ Object
The coverage ratio as a percentage.
-
#ratio ⇒ Object
The fraction of executable lines that were executed.
Instance Method Details
#complete? ⇒ Boolean
Whether all executable lines were executed.
21 22 23 |
# File 'lib/covered/coverage.rb', line 21 def complete? executed_count == executable_count end |
#percentage ⇒ Object
The coverage ratio as a percentage.
27 28 29 |
# File 'lib/covered/coverage.rb', line 27 def percentage ratio * 100 end |
#ratio ⇒ Object
The fraction of executable lines that were executed.
13 14 15 16 17 |
# File 'lib/covered/coverage.rb', line 13 def ratio return 1.0 if executable_count.zero? Rational(executed_count, executable_count) end |