aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorrigani <rigani.exe@gmail.com>2018-09-12 18:45:47 +0900
committerrigani <rigani.exe@gmail.com>2018-09-12 18:45:47 +0900
commit66bfb37f50cfee0acf607c5dda39fd55a3ee3f50 (patch)
tree3488e4fdf4da01b434f2d0274c0cc0fd7b84610a /activesupport/lib
parent90982d850eea56a97ff7c3b6dacba61d60729741 (diff)
downloadrails-66bfb37f50cfee0acf607c5dda39fd55a3ee3f50.tar.gz
rails-66bfb37f50cfee0acf607c5dda39fd55a3ee3f50.tar.bz2
rails-66bfb37f50cfee0acf607c5dda39fd55a3ee3f50.zip
Faster multiple_of? method
Diffstat (limited to 'activesupport/lib')
-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