aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/date_time
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-05-07 18:39:03 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2009-05-07 18:39:03 -0700
commit4817bf94d135c44ddfae1a30acb15de989e3c86c (patch)
treed64f3a7ffb205d53ae4bbfe37ad0453e99148f36 /activesupport/lib/active_support/core_ext/date_time
parent49ed45213607ed6ce7e6c13c319bf55f916a0ac4 (diff)
downloadrails-4817bf94d135c44ddfae1a30acb15de989e3c86c.tar.gz
rails-4817bf94d135c44ddfae1a30acb15de989e3c86c.tar.bz2
rails-4817bf94d135c44ddfae1a30acb15de989e3c86c.zip
Check for date/time methods that moved upstream in 1.9
Diffstat (limited to 'activesupport/lib/active_support/core_ext/date_time')
-rw-r--r--activesupport/lib/active_support/core_ext/date_time/conversions.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/date_time/conversions.rb b/activesupport/lib/active_support/core_ext/date_time/conversions.rb
index ddfa8d610d..5f01bc4fd6 100644
--- a/activesupport/lib/active_support/core_ext/date_time/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/date_time/conversions.rb
@@ -58,7 +58,7 @@ class DateTime
# Converts self to a Ruby Date object; time portion is discarded
def to_date
::Date.new(year, month, day)
- end
+ end unless method_defined?(:to_date)
# Attempts to convert self to a Ruby Time object; returns self if out of range of Ruby Time class
# If self has an offset other than 0, self will just be returned unaltered, since there's no clean way to map it to a Time
@@ -69,12 +69,12 @@ class DateTime
# To be able to keep Times, Dates and DateTimes interchangeable on conversions
def to_datetime
self
- end
+ end unless method_defined?(:to_datetime)
# Converts datetime to an appropriate format for use in XML
def xmlschema
strftime("%Y-%m-%dT%H:%M:%S%Z")
- end if RUBY_VERSION < '1.9'
+ end unless method_defined?(:xmlschema)
# Converts self to a floating-point number of seconds since the Unix epoch
def to_f