aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/time_with_zone.rb
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2008-03-23 04:44:50 +0000
committerRick Olson <technoweenie@gmail.com>2008-03-23 04:44:50 +0000
commite1790efb85010c5e6f39eef029abf7b71ae3b9a6 (patch)
treea9600d7e8f83bcab5cbcbda25074a12c2095594d /activesupport/lib/active_support/time_with_zone.rb
parent038139870825ad843b0683e5273dc4d11cb684b3 (diff)
downloadrails-e1790efb85010c5e6f39eef029abf7b71ae3b9a6.tar.gz
rails-e1790efb85010c5e6f39eef029abf7b71ae3b9a6.tar.bz2
rails-e1790efb85010c5e6f39eef029abf7b71ae3b9a6.zip
Ensure that TimeWithZone#to_yaml works when passed a YAML::Emitter. [rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9081 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/time_with_zone.rb')
-rw-r--r--activesupport/lib/active_support/time_with_zone.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb
index 7b9b121a17..56c4f40f32 100644
--- a/activesupport/lib/active_support/time_with_zone.rb
+++ b/activesupport/lib/active_support/time_with_zone.rb
@@ -80,7 +80,11 @@ module ActiveSupport
end
def to_yaml(options = {})
- time.to_yaml(options).gsub('Z', formatted_offset(true, 'Z'))
+ if options.kind_of?(YAML::Emitter)
+ utc.to_yaml(options)
+ else
+ time.to_yaml(options).gsub('Z', formatted_offset(true, 'Z'))
+ end
end
def httpdate