Skip to content
This repository
Browse code

Merge [6099] from trunk. Compatibility with Ruby 1.8.6: make private …

…Time#to_date and #to_datetime public.

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-stable@6281 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit bbe3dea3fa46355095818d193c7b74d03638ef5d 1 parent 9679cb4
Jeremy Kemper authored
3  activesupport/CHANGELOG
... ...
@@ -1,5 +1,8 @@
1 1
 *SVN*
2 2
 
  3
+* Ruby 1.8.6 and 1.9 define private Time#to_date and #to_datetime; make them
  4
+public for compatibility.  [Jeremy Kemper]
  5
+
3 6
 * Deprecation: warn on stderr if RAILS_DEFAULT_LOGGER isn't set yet.  [Jeremy Kemper]
4 7
 
5 8
 
10  activesupport/lib/active_support/core_ext/time.rb
... ...
@@ -1,3 +1,13 @@
  1
+require 'date'
  2
+require 'time'
  3
+
  4
+# Ruby 1.8-cvs and 1.9 define private Time#to_date
  5
+class Time
  6
+  %w(to_date to_datetime).each do |method|
  7
+    public method if private_instance_methods.include?(method)
  8
+  end
  9
+end
  10
+
1 11
 require File.dirname(__FILE__) + '/time/calculations'
2 12
 require File.dirname(__FILE__) + '/time/conversions'
3 13
 
3  activesupport/lib/active_support/core_ext/time/conversions.rb
... ...
@@ -1,6 +1,3 @@
1  
-require 'date'
2  
-require 'time'
3  
-
4 1
 module ActiveSupport #:nodoc:
5 2
   module CoreExtensions #:nodoc:
6 3
     module Time #:nodoc:

0 notes on commit bbe3dea

Please sign in to comment.
Something went wrong with that request. Please try again.