aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/integer/multiple.rb
diff options
context:
space:
mode:
authorFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-05-11 23:16:44 -0500
committerFrancesco Rodriguez <lrodriguezsanc@gmail.com>2012-05-11 23:16:44 -0500
commitc78c29556e3fe338e4f8d27a917765a4f75c9b0d (patch)
treec1b6ee112abfc151e1ffee110ebe2491bae5e0ee /activesupport/lib/active_support/core_ext/integer/multiple.rb
parentfc6ab69777af21db3afb45de8ae08ffc316e69e9 (diff)
downloadrails-c78c29556e3fe338e4f8d27a917765a4f75c9b0d.tar.gz
rails-c78c29556e3fe338e4f8d27a917765a4f75c9b0d.tar.bz2
rails-c78c29556e3fe338e4f8d27a917765a4f75c9b0d.zip
added examples to Integer#multiple_of?
Diffstat (limited to 'activesupport/lib/active_support/core_ext/integer/multiple.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/integer/multiple.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/integer/multiple.rb b/activesupport/lib/active_support/core_ext/integer/multiple.rb
index 8dff217ddc..907a0df723 100644
--- a/activesupport/lib/active_support/core_ext/integer/multiple.rb
+++ b/activesupport/lib/active_support/core_ext/integer/multiple.rb
@@ -1,5 +1,9 @@
class Integer
# Check whether the integer is evenly divisible by the argument.
+ #
+ # 0.multiple_of?(0) #=> true
+ # 5.multiple_of?(5) #=> false
+ # 10.multiple_of?(2) #=> true
def multiple_of?(number)
number != 0 ? self % number == 0 : zero?
end