Skip to content
This repository
Browse code

Time marshalling backported [#4286 state:committed]

Signed-off-by: wycats <wycats@gmail.com>
  • Loading branch information...
commit cf7ed7cf2dcd552d3b9e1076267ec0cc4c97564b 1 parent c1b2200
Santiago Pastorino authored March 28, 2010 wycats committed March 28, 2010
12  activesupport/lib/active_support/core_ext/time.rb
@@ -15,14 +15,18 @@ class << self
15 15
       alias_method :_original_load, :_load
16 16
       def _load(marshaled_time)
17 17
         time = _original_load(marshaled_time)
18  
-        utc = time.send(:remove_instance_variable, '@marshal_with_utc_coercion') if time.instance_variable_defined?('@marshal_with_utc_coercion')
19  
-        utc ? time.utc : time
  18
+        time.instance_eval do
  19
+          if defined?(@marshal_with_utc_coercion)
  20
+            val = remove_instance_variable("@marshal_with_utc_coercion")
  21
+          end
  22
+          val ? utc : self
  23
+        end
20 24
       end
21 25
     end
22  
-    
  26
+
23 27
     alias_method :_original_dump, :_dump
24 28
     def _dump(*args)
25  
-      obj = self.dup
  29
+      obj = dup
26 30
       obj.instance_variable_set('@marshal_with_utc_coercion', utc?)
27 31
       obj._original_dump(*args)
28 32
     end

0 notes on commit cf7ed7c

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