summaryrefslogtreecommitdiffstats
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
commit3052eb803078d0111753afce34ab6f58ccf6183f (patch)
tree943c698476611aa0e426be833fa641fdc16836d9 /range.c
parent7f21eaf4e07c6f0d29930b08be223cc36ce706c8 (diff)
downloadruby-3052eb803078d0111753afce34ab6f58ccf6183f.tar.gz
ruby-3052eb803078d0111753afce34ab6f58ccf6183f.tar.xz
ruby-3052eb803078d0111753afce34ab6f58ccf6183f.zip
* range.c (range_include): return false unless included in numeric
range. fixed: [ruby-dev:27975] git-svn-id: http://svn.ruby-lang.org/repos/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 d18b4efe0..fadcfb41a 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);
}