aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/range/conversions.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/core_ext/range/conversions.rb')
-rw-r--r--activesupport/lib/active_support/core_ext/range/conversions.rb14
1 files changed, 8 insertions, 6 deletions
diff --git a/activesupport/lib/active_support/core_ext/range/conversions.rb b/activesupport/lib/active_support/core_ext/range/conversions.rb
index 677ba639ec..77e86a6ae6 100644
--- a/activesupport/lib/active_support/core_ext/range/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/range/conversions.rb
@@ -6,16 +6,18 @@ module ActiveSupport #:nodoc:
DATE_FORMATS = {
:db => Proc.new { |start, stop| "BETWEEN '#{start.to_s(:db)}' AND '#{stop.to_s(:db)}'" }
}
-
- def self.included(klass) #:nodoc:
- klass.send(:alias_method, :to_default_s, :to_s)
- klass.send(:alias_method, :to_s, :to_formatted_s)
+
+ def self.included(base) #:nodoc:
+ base.class_eval do
+ alias_method :to_default_s, :to_s
+ alias_method :to_s, :to_formatted_s
+ end
end
-
+
def to_formatted_s(format = :default)
DATE_FORMATS[format] ? DATE_FORMATS[format].call(first, last) : to_default_s
end
end
end
end
-end \ No newline at end of file
+end