Skip to content

Commit 479bd52

Browse files
committed
Remove unneeded Time patch to support Ruby 1.9
1 parent 21f02f3 commit 479bd52

File tree

2 files changed

+2
-30
lines changed

2 files changed

+2
-30
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require 'active_support/core_ext/time/acts_like'
22
require 'active_support/core_ext/time/calculations'
33
require 'active_support/core_ext/time/conversions'
4-
require 'active_support/core_ext/time/marshal'
54
require 'active_support/core_ext/time/zones'
Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,3 @@
1-
# Ruby 1.9.2 adds utc_offset and zone to Time, but marshaling only
2-
# preserves utc_offset. Preserve zone also, even though it may not
3-
# work in some edge cases.
4-
if Time.local(2010).zone != Marshal.load(Marshal.dump(Time.local(2010))).zone
5-
class Time
6-
class << self
7-
alias_method :_load_without_zone, :_load
8-
def _load(marshaled_time)
9-
time = _load_without_zone(marshaled_time)
10-
time.instance_eval do
11-
if zone = defined?(@_zone) && remove_instance_variable('@_zone')
12-
ary = to_a
13-
ary[0] += subsec if ary[0] == sec
14-
ary[-1] = zone
15-
utc? ? Time.utc(*ary) : Time.local(*ary)
16-
else
17-
self
18-
end
19-
end
20-
end
21-
end
1+
require 'active_support/deprecation'
222

23-
alias_method :_dump_without_zone, :_dump
24-
def _dump(*args)
25-
obj = dup
26-
obj.instance_variable_set('@_zone', zone)
27-
obj.send :_dump_without_zone, *args
28-
end
29-
end
30-
end
3+
ActiveSupport::Deprecation.warn("This is deprecated and will be removed in Rails 5.1 with no replacement.")

0 commit comments

Comments
 (0)