From 7a2554d9a35545ad24937f04c6416df3ed3f26d9 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sun, 15 Nov 2009 01:22:26 +0100 Subject: Let Integer#multiple_of? accept zero as argument [#2982 state:committed] Signed-off-by: Jeremy Kemper --- activesupport/lib/active_support/core_ext/integer/multiple.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/integer/multiple.rb b/activesupport/lib/active_support/core_ext/integer/multiple.rb index 40bea54c67..8dff217ddc 100644 --- a/activesupport/lib/active_support/core_ext/integer/multiple.rb +++ b/activesupport/lib/active_support/core_ext/integer/multiple.rb @@ -1,6 +1,6 @@ class Integer # Check whether the integer is evenly divisible by the argument. def multiple_of?(number) - self % number == 0 + number != 0 ? self % number == 0 : zero? end end -- cgit v1.2.3