aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/date
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/core_ext/date')
-rw-r--r--activesupport/lib/active_support/core_ext/date/calculations.rb18
-rw-r--r--activesupport/lib/active_support/core_ext/date/conversions.rb12
2 files changed, 17 insertions, 13 deletions
diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb
index c28d0c876b..37f5d3b544 100644
--- a/activesupport/lib/active_support/core_ext/date/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/date/calculations.rb
@@ -4,13 +4,15 @@ module ActiveSupport #:nodoc:
# Enables the use of time calculations within Time itself
module Calculations
def self.included(base) #:nodoc:
- base.send(:extend, ClassMethods)
-
- base.send(:alias_method, :plus_without_duration, :+)
- base.send(:alias_method, :+, :plus_with_duration)
-
- base.send(:alias_method, :minus_without_duration, :-)
- base.send(:alias_method, :-, :minus_with_duration)
+ base.extend ClassMethods
+
+ base.instance_eval do
+ alias_method :plus_without_duration, :+
+ alias_method :+, :plus_with_duration
+
+ alias_method :minus_without_duration, :-
+ alias_method :-, :minus_with_duration
+ end
end
module ClassMethods
@@ -199,4 +201,4 @@ module ActiveSupport #:nodoc:
end
end
end
-end \ No newline at end of file
+end
diff --git a/activesupport/lib/active_support/core_ext/date/conversions.rb b/activesupport/lib/active_support/core_ext/date/conversions.rb
index 6e864aee5e..3491dec25a 100644
--- a/activesupport/lib/active_support/core_ext/date/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/date/conversions.rb
@@ -11,11 +11,13 @@ module ActiveSupport #:nodoc:
:rfc822 => "%e %b %Y"
}
- def self.included(klass) #:nodoc:
- klass.send(:alias_method, :to_default_s, :to_s)
- klass.send(:alias_method, :to_s, :to_formatted_s)
- klass.send(:alias_method, :default_inspect, :inspect)
- klass.send(:alias_method, :inspect, :readable_inspect)
+ def self.included(base) #:nodoc:
+ base.instance_eval do
+ alias_method :to_default_s, :to_s
+ alias_method :to_s, :to_formatted_s
+ alias_method :default_inspect, :inspect
+ alias_method :inspect, :readable_inspect
+ end
end
def to_formatted_s(format = :default)