Module: Coverage
- Defined in:
- coverage.c
Class Method Summary collapse
-
.peek_result ⇒ Hash
Returns a hash that contains filename as key and coverage array as value.
-
.result ⇒ Hash
Returns a hash that contains filename as key and coverage array as value and disables coverage measurement.
-
.start ⇒ nil
Enables coverage measurement.
Class Method Details
.peek_result ⇒ Hash
Returns a hash that contains filename as key and coverage array as value.
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'coverage.c', line 62
static VALUE
rb_coverage_peek_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_peek_result_i, ncoverages);
rb_hash_freeze(ncoverages);
return ncoverages;
}
|
.result ⇒ Hash
Returns a hash that contains filename as key and coverage array as value and disables coverage measurement.
82 83 84 85 86 87 88 89 90 |
# File 'coverage.c', line 82
static VALUE
rb_coverage_result(VALUE klass)
{
VALUE ncoverages = rb_coverage_peek_result(klass);
VALUE coverages = rb_get_coverages();
st_foreach(RHASH_TBL(coverages), coverage_clear_result_i, ncoverages);
rb_reset_coverages();
return ncoverages;
}
|
.start ⇒ nil
Enables coverage measurement.
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;
}
|