aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2018-09-12 17:23:32 -0400
committerGitHub <noreply@github.com>2018-09-12 17:23:32 -0400
commit792fead512be390fdaf219b8bf3e17aa335bd7f4 (patch)
tree68ddfead6a3c746b8d240567500f7cd70490ff65
parenta66efa0b92e2b4fd6f79baa485fa3af17be257c4 (diff)
parent66bfb37f50cfee0acf607c5dda39fd55a3ee3f50 (diff)
downloadrails-792fead512be390fdaf219b8bf3e17aa335bd7f4.tar.gz
rails-792fead512be390fdaf219b8bf3e17aa335bd7f4.tar.bz2
rails-792fead512be390fdaf219b8bf3e17aa335bd7f4.zip
Merge pull request #33854 from rigani/integer-multiple
Faster multiple_of? method
-rw-r--r--activesupport/lib/active_support/core_ext/integer/multiple.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/integer/multiple.rb b/activesupport/lib/active_support/core_ext/integer/multiple.rb
index e7606662d3..bd57a909c5 100644
--- a/activesupport/lib/active_support/core_ext/integer/multiple.rb
+++ b/activesupport/lib/active_support/core_ext/integer/multiple.rb
@@ -7,6 +7,6 @@ class Integer
# 6.multiple_of?(5) # => false
# 10.multiple_of?(2) # => true
def multiple_of?(number)
- number != 0 ? self % number == 0 : zero?
+ number == 0 ? self == 0 : self % number == 0
end
end