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

Instance Method Details

#complete?Boolean

Whether all executable lines were executed.

Returns:

  • (Boolean)


21
22
23
# File 'lib/covered/coverage.rb', line 21

def complete?
	executed_count == executable_count
end

#percentageObject

The coverage ratio as a percentage.



27
28
29
# File 'lib/covered/coverage.rb', line 27

def percentage
	ratio * 100
end

#ratioObject

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