This project is archived and is in readonly mode.
[PATCH] Let Integer#multiple_of? accept zero as argument
Reported by Xavier Noria | August 1st, 2009 @ 02:45 AM
Currently Integer#multiple_of? delegates to %, and so raises a division by zero exception if the argument is zero.
But that case is of course well-defined: no integer is multiple of zero except zero. This little patch adds that.
Comments and changes to this ticket
-
CancelProfileIsBroken September 25th, 2009 @ 01:00 PM
- Tag changed from activesupport, integer, multiple_of to activesupport, bugmash, integer, multiple_of
-
Robert Rouse September 26th, 2009 @ 03:06 AM
The current patch does not apply on the 2.3 stable branch. I have reformatted the patch for the branch.
Attached is the patch.
-
Pat Allan September 26th, 2009 @ 04:56 PM
- Tag changed from activesupport, bugmash, integer, multiple_of to activesupport, bugmash, bugmash-review, integer, multiple_of
Just tested on 2.3 and master, all good. +1 Verified.
-
Josh Sharpe September 26th, 2009 @ 06:19 PM
- Title changed from Let Integer#multiple_of? accept zero as argument to [PATCH] Let Integer#multiple_of? accept zero as argument
+1 both patches work
-
sr.iniv.t September 26th, 2009 @ 07:26 PM
+1 verified.
Xavier's patch applies on 2-3-stable and all tests pass. Robert's patch didn't apply for me for whatever reason, don't know what i was doing wrong.
-
Robert Rouse September 26th, 2009 @ 09:15 PM
sr.iniv.t:
You probably didn't have the 2-3-stable branch checked out when you applied the patch I attached. The original patch will apply on master. Mine applies on 2-3-stable. They need to be different because master adds methods to the Integer class directly. 2-3-stable uses a module.
-
sr.iniv.t September 26th, 2009 @ 09:21 PM
Robert:
Errr, sorry about the mix up. I was indeed trying Xavier's patch on master. I applied your patch to 2-3-stable and the patch applies fine. :-)
-
CancelProfileIsBroken September 27th, 2009 @ 11:46 AM
- Tag changed from activesupport, bugmash, bugmash-review, integer, multiple_of to activesupport, bugmash-review, integer, multiple_of
-
Xavier Noria November 15th, 2009 @ 12:26 AM
- Assigned user set to Jeremy Kemper
Updates the patch so that it applies after the recent 1.8.6 cleanup in AS. New file is let_multiple_of_accept_zero_2.diff.
-
Repository January 3rd, 2010 @ 04:26 AM
- State changed from new to committed
(from [7a2554d9a35545ad24937f04c6416df3ed3f26d9]) Let Integer#multiple_of? accept zero as argument
[#2982 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net
http://github.com/rails/rails/commit/7a2554d9a35545ad24937f04c6416d... -
Rizwan Reza May 15th, 2010 @ 06:40 PM
- Tag changed from activesupport, bugmash-review, integer, multiple_of to activesupport, integer, multiple_of
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 2982 [PATCH] Let Integer#multiple_of? accept zero as argument [#2982 state:committed]