diff options
author | José Valim <jose.valim@gmail.com> | 2011-12-24 13:12:33 -0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-12-24 13:12:33 -0800 |
commit | 41e466fda827b9e002bb356e34ba4b82f7b72059 (patch) | |
tree | 511fb084ef0aeec087c758b8028a9bea1dbf2674 | |
parent | 7c9bcbb5e486a5d5e35d38c5fbcbea6af88fc23a (diff) | |
parent | daef51ee0ae65a3646ec440107cd6686d8fb9e8c (diff) | |
download | rails-41e466fda827b9e002bb356e34ba4b82f7b72059.tar.gz rails-41e466fda827b9e002bb356e34ba4b82f7b72059.tar.bz2 rails-41e466fda827b9e002bb356e34ba4b82f7b72059.zip |
Merge pull request #4173 from nashby/remove-time-marshaling-18
remove Time._dump and Time._load patching for ruby 1.8
-rw-r--r-- | activesupport/lib/active_support/core_ext/time/marshal.rb | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/marshal.rb b/activesupport/lib/active_support/core_ext/time/marshal.rb index 457d3f5b62..1bf622d6a6 100644 --- a/activesupport/lib/active_support/core_ext/time/marshal.rb +++ b/activesupport/lib/active_support/core_ext/time/marshal.rb @@ -1,30 +1,3 @@ -# Pre-1.9 versions of Ruby have a bug with marshaling Time instances, where utc instances are -# unmarshalled in the local zone, instead of utc. We're layering behavior on the _dump and _load -# methods so that utc instances can be flagged on dump, and coerced back to utc on load. -if !Marshal.load(Marshal.dump(Time.now.utc)).utc? - class Time - class << self - alias_method :_load_without_utc_flag, :_load - def _load(marshaled_time) - time = _load_without_utc_flag(marshaled_time) - time.instance_eval do - if defined?(@marshal_with_utc_coercion) - val = remove_instance_variable("@marshal_with_utc_coercion") - end - val ? utc : self - end - end - end - - alias_method :_dump_without_utc_flag, :_dump - def _dump(*args) - obj = dup - obj.instance_variable_set('@marshal_with_utc_coercion', utc?) - obj._dump_without_utc_flag(*args) - end - end -end - # Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only # preserves utc_offset. Preserve zone also, even though it may not # work in some edge cases. |