summaryrefslogtreecommitdiff
path: root/range.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-12-09 14:17:09 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-12-09 14:17:09 +0000
commitc4c90eca3453cdfe888fce59c8806bdca5e09c97 (patch)
tree943c698476611aa0e426be833fa641fdc16836d9 /range.c
parent949f6fe394817675aee9277fbd7777bf360fabdf (diff)
* range.c (range_include): return false unless included in numeric
range. fixed: [ruby-dev:27975] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'range.c')
-rw-r--r--range.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/range.c b/range.c
index d18b4efe01..fadcfb41a5 100644
--- a/range.c
+++ b/range.c
@@ -625,8 +625,9 @@ range_include(VALUE range, VALUE val)
rb_obj_is_kind_of(beg, rb_cNumeric) ||
rb_obj_is_kind_of(end, rb_cNumeric);
- if (nv) {
- numeric_range:
+ if (nv ||
+ !NIL_P(rb_check_to_integer(beg, "to_int")) ||
+ !NIL_P(rb_check_to_integer(end, "to_int"))) {
if (r_le(beg, val)) {
if (EXCL(range)) {
if (r_lt(val, end)) return Qtrue;
@@ -635,10 +636,8 @@ range_include(VALUE range, VALUE val)
if (r_le(val, end)) return Qtrue;
}
}
+ return Qfalse;
}
- if (!NIL_P(rb_check_to_integer(beg, "to_int")) ||
- !NIL_P(rb_check_to_integer(end, "to_int")))
- goto numeric_range;
return rb_call_super(1, &val);
}