aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/core_ext/fixnum.rb4
-rw-r--r--activesupport/lib/active_support/core_ext/fixnum/even_odd.rb6
2 files changed, 9 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/fixnum.rb b/activesupport/lib/active_support/core_ext/fixnum.rb
index fecef1da52..e983d5c0f9 100644
--- a/activesupport/lib/active_support/core_ext/fixnum.rb
+++ b/activesupport/lib/active_support/core_ext/fixnum.rb
@@ -3,3 +3,7 @@ require File.dirname(__FILE__) + '/fixnum/even_odd'
class Fixnum #:nodoc:
include ActiveSupport::CoreExtensions::Fixnum::EvenOdd
end
+
+class Bignum #:nodoc:
+ include ActiveSupport::CoreExtensions::Fixnum::EvenOdd
+end \ No newline at end of file
diff --git a/activesupport/lib/active_support/core_ext/fixnum/even_odd.rb b/activesupport/lib/active_support/core_ext/fixnum/even_odd.rb
index 1fa6b95846..c0e9da18fa 100644
--- a/activesupport/lib/active_support/core_ext/fixnum/even_odd.rb
+++ b/activesupport/lib/active_support/core_ext/fixnum/even_odd.rb
@@ -7,8 +7,12 @@ module ActiveSupport #:nodoc:
# * 2.even? # => true
# * 2.odd? # => false
module EvenOdd
+ def multiple_of?(number)
+ self % number == 0
+ end
+
def even?
- self % 2 == 0
+ multiple_of? 2
end
def odd?