ruby-changes:4777
From: ko1@a...
Date: Fri, 2 May 2008 17:31:19 +0900 (JST)
Subject: [ruby-changes:4777] matz - Ruby:r16271 (trunk): * range.c (range_step): call to_int if step is not a numeric
matz 2008-05-02 17:31:04 +0900 (Fri, 02 May 2008)
New Revision: 16271
Modified files:
trunk/ChangeLog
trunk/range.c
Log:
* range.c (range_step): call to_int if step is not a numeric
value. [ruby-dev:34575]
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16271&r2=16270&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/range.c?r1=16271&r2=16270&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 16270)
+++ ChangeLog (revision 16271)
@@ -1,3 +1,8 @@
+Fri May 2 17:29:59 2008 Yukihiro Matsumoto <matz@r...>
+
+ * range.c (range_step): call to_int if step is not a numeric
+ value. [ruby-dev:34575]
+
Fri May 2 16:10:57 2008 Yukihiro Matsumoto <matz@r...>
* range.c (range_step): do not forcefully convert steps into
Index: range.c
===================================================================
--- range.c (revision 16270)
+++ range.c (revision 16271)
@@ -306,6 +306,9 @@
}
else {
rb_scan_args(argc, argv, "01", &step);
+ if (!rb_obj_is_kind_of(step, rb_cNumeric)) {
+ step = rb_to_int(step);
+ }
if (rb_funcall(step, '<', 1, INT2FIX(0))) {
rb_raise(rb_eArgError, "step can't be negative");
}
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/