Project

General

Profile

Feature #12996 » range_eqq2.patch

ksss (Yuki Kurihara), 05/17/2017 02:14 PM

View differences:

range.c
return rb_exec_recursive(inspect_range, range, 0);
}
VALUE rb_str_include_range_p(VALUE beg, VALUE end, VALUE val, VALUE exclusive);
/*
* call-seq:
* rng === obj -> true or false
......
static VALUE
range_eqq(VALUE range, VALUE val)
{
VALUE beg = RANGE_BEG(range);
VALUE end = RANGE_END(range);
if (FIXNUM_P(beg) || FIXNUM_P(end)) {
return r_cover_p(range, beg, end, val);
}
else if (RB_TYPE_P(beg, T_STRING) && RB_TYPE_P(end, T_STRING)) {
return rb_str_include_range_p(beg, end, val, RANGE_EXCL(range));
}
return rb_funcall(range, rb_intern("include?"), 1, val);
}
......
return r_cover_p(range, beg, end, val);
}
else if (RB_TYPE_P(beg, T_STRING) && RB_TYPE_P(end, T_STRING)) {
VALUE rb_str_include_range_p(VALUE beg, VALUE end, VALUE val, VALUE exclusive);
return rb_str_include_range_p(beg, end, val, RANGE_EXCL(range));
}
/* TODO: ruby_frame->this_func = rb_intern("include?"); */
(2-2/2)