summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--range.c9
2 files changed, 9 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 70fd2d3aa6..a49b689e14 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Dec 9 23:16:51 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * range.c (range_include): return false unless included in numeric
+ range. fixed: [ruby-dev:27975]
+
Thu Dec 8 02:07:19 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (umethod_bind): adjust invoking class for module method.
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);
}