Module: Coverage

Defined in:
coverage.c

Class Method Summary collapse

Class Method Details

.resultHash

Returns a hash that contains filename as key and coverage array as value and disables coverage measurement.

Returns:

  • (Hash)


55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'coverage.c', line 55

static VALUE
rb_coverage_result(VALUE klass)
{
    VALUE coverages = rb_get_coverages();
    VALUE ncoverages = rb_hash_new();
    if (!RTEST(coverages)) {
	rb_raise(rb_eRuntimeError, "coverage measurement is not enabled");
    }
    st_foreach(RHASH_TBL(coverages), coverage_result_i, ncoverages);
    rb_hash_freeze(ncoverages);
    rb_reset_coverages();
    return ncoverages;
}

.startnil

Enables coverage measurement.

Returns:

  • (nil)


22
23
24
25
26
27
28
29
30
31
32
33
# File 'coverage.c', line 22

static VALUE
rb_coverage_start(VALUE klass)
{
    if (!RTEST(rb_get_coverages())) {
	if (rb_coverages == Qundef) {
	    rb_coverages = rb_hash_new();
	    rb_obj_hide(rb_coverages);
	}
	rb_set_coverages(rb_coverages);
    }
    return Qnil;
}