1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2005-12-09 14:17:09 +00:00
parent 949f6fe394
commit c4c90eca34
2 changed files with 9 additions and 5 deletions

View file

@ -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.

View file

@ -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);
}