Returns a hash that contains filename as key and coverage array as value.
If clear is true, it clears the counters to zero. If stop
is true, it disables coverage measurement.
static VALUE
rb_coverage_result(int argc, VALUE *argv, VALUE klass)
{
VALUE ncoverages;
VALUE opt;
int stop = 1, clear = 1;
rb_scan_args(argc, argv, "01", &opt);
if (argc == 1) {
opt = rb_convert_type(opt, T_HASH, "Hash", "to_hash");
stop = RTEST(rb_hash_lookup(opt, ID2SYM(rb_intern("stop"))));
clear = RTEST(rb_hash_lookup(opt, ID2SYM(rb_intern("clear"))));
}
ncoverages = rb_coverage_peek_result(klass);
if (stop && !clear) {
rb_warn("stop implies clear");
clear = 1;
}
if (clear) {
rb_clear_coverages();
if (!NIL_P(me2counter)) rb_hash_foreach(me2counter, clear_me2counter_i, Qnil);
}
if (stop) {
rb_reset_coverages();
me2counter = Qnil;
}
return ncoverages;
}