aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2009-11-09 21:46:16 +0100
committerXavier Noria <fxn@hashref.com>2009-11-09 22:16:51 +0100
commit329e7f44417c00a8d6fee337c288a463e9d64346 (patch)
tree0fb81a154cad7a0315aa046b25d01cbfebef8376 /activesupport/lib
parentb6598c683bb8f8ef484f54755cced77a5d6200bb (diff)
downloadrails-329e7f44417c00a8d6fee337c288a463e9d64346.tar.gz
rails-329e7f44417c00a8d6fee337c288a463e9d64346.tar.bz2
rails-329e7f44417c00a8d6fee337c288a463e9d64346.zip
Integer#even? and Integer#odd? are not needed for Ruby >= 1.8.7
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/core_ext/integer.rb2
-rw-r--r--activesupport/lib/active_support/core_ext/integer/even_odd.rb16
-rw-r--r--activesupport/lib/active_support/core_ext/integer/multiple.rb6
-rw-r--r--activesupport/lib/active_support/ruby/shim.rb2
4 files changed, 7 insertions, 19 deletions
diff --git a/activesupport/lib/active_support/core_ext/integer.rb b/activesupport/lib/active_support/core_ext/integer.rb
index 7ba018ed7f..a44a1b4c74 100644
--- a/activesupport/lib/active_support/core_ext/integer.rb
+++ b/activesupport/lib/active_support/core_ext/integer.rb
@@ -1,3 +1,3 @@
-require 'active_support/core_ext/integer/even_odd'
+require 'active_support/core_ext/integer/multiple'
require 'active_support/core_ext/integer/inflections'
require 'active_support/core_ext/integer/time'
diff --git a/activesupport/lib/active_support/core_ext/integer/even_odd.rb b/activesupport/lib/active_support/core_ext/integer/even_odd.rb
deleted file mode 100644
index 8f9a97b44c..0000000000
--- a/activesupport/lib/active_support/core_ext/integer/even_odd.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class Integer
- # Check whether the integer is evenly divisible by the argument.
- def multiple_of?(number)
- self % number == 0
- end
-
- # Is the integer a multiple of 2?
- def even?
- multiple_of? 2
- end unless method_defined?(:even?)
-
- # Is the integer not a multiple of 2?
- def odd?
- !even?
- end unless method_defined?(:odd?)
-end
diff --git a/activesupport/lib/active_support/core_ext/integer/multiple.rb b/activesupport/lib/active_support/core_ext/integer/multiple.rb
new file mode 100644
index 0000000000..40bea54c67
--- /dev/null
+++ b/activesupport/lib/active_support/core_ext/integer/multiple.rb
@@ -0,0 +1,6 @@
+class Integer
+ # Check whether the integer is evenly divisible by the argument.
+ def multiple_of?(number)
+ self % number == 0
+ end
+end
diff --git a/activesupport/lib/active_support/ruby/shim.rb b/activesupport/lib/active_support/ruby/shim.rb
index 1f47c04826..f811239077 100644
--- a/activesupport/lib/active_support/ruby/shim.rb
+++ b/activesupport/lib/active_support/ruby/shim.rb
@@ -4,7 +4,6 @@
# Date next_year, next_month
# DateTime to_date, to_datetime, xmlschema
# Enumerable group_by, each_with_object, none?
-# Integer even?, odd?
# Process Process.daemon
# REXML security fix
# String ord
@@ -13,7 +12,6 @@ require 'active_support'
require 'active_support/core_ext/date/calculations'
require 'active_support/core_ext/date_time/conversions'
require 'active_support/core_ext/enumerable'
-require 'active_support/core_ext/integer/even_odd'
require 'active_support/core_ext/process/daemon'
require 'active_support/core_ext/string/conversions'
require 'active_support/core_ext/rexml'