Coverage

module Coverage

Coverage provides coverage measurement feature for Ruby- This feature is experimental, so these APIs may be changed in future-

Usage

  1. require “coverage”

  2. do ::start

  3. require or load Ruby source file

  4. ::result will return a hash that contains filename as key and coverage array as value. A coverage array gives, for each line, the number of line execution by the interpreter. A nil value means coverage is disabled for this line (lines like else and end).

Example

[foo.rb]
s = 0
10.times do |