summaryrefslogtreecommitdiff
path: root/range.c
diff options
context:
space:
mode:
Diffstat (limited to 'range.c')
-rw-r--r--range.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/range.c b/range.c
index 8f48cd9..0dc0fb8 100644
--- a/range.c
+++ b/range.c
@@ -23,6 +23,7 @@ static ID id_beg, id_end, id_excl, id_integer_p, id_div;
#define id_succ idSucc
static VALUE r_cover_p(VALUE, VALUE, VALUE, VALUE);
+static VALUE range_include(VALUE range, VALUE val);
#define RANGE_BEG(r) (RSTRUCT(r)->as.ary[0])
#define RANGE_END(r) (RSTRUCT(r)->as.ary[1])
@@ -1134,7 +1135,12 @@ range_inspect(VALUE range)
static VALUE
range_eqq(VALUE range, VALUE val)
{
- return rb_funcall(range, rb_intern("include?"), 1, val);
+ ID pred;
+ CONST_ID(pred, "include?");
+ if (rb_method_basic_definition_p(RBASIC_CLASS(range), pred)) {
+ return range_include(range, val);
+ }
+ return rb_funcall(range, pred, 1, val);
}