mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Faster multiple_of? method
This commit is contained in:
parent
90982d850e
commit
66bfb37f50
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue