activesupport 4.2.8 → 4.2.9.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +36 -0
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +0 -14
- data/lib/active_support/core_ext/date_time/calculations.rb +2 -7
- data/lib/active_support/core_ext/date_time/compatibility.rb +10 -0
- data/lib/active_support/core_ext/marshal.rb +2 -2
- data/lib/active_support/core_ext/time/calculations.rb +3 -1
- data/lib/active_support/core_ext/time/compatibility.rb +10 -1
- data/lib/active_support/gem_version.rb +2 -2
- data/lib/active_support/hash_with_indifferent_access.rb +4 -0
- data/lib/active_support/logger.rb +11 -0
- data/lib/active_support/testing/time_helpers.rb +11 -9
- data/lib/active_support/time_with_zone.rb +13 -1
- data/lib/active_support/xml_mini/libxml.rb +1 -3
- data/lib/active_support/xml_mini/libxmlsax.rb +1 -4
- data/lib/active_support/xml_mini/nokogiri.rb +1 -3
- data/lib/active_support/xml_mini/nokogirisax.rb +1 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26d4680dcdff262e078a9789d323363075524dc9
|
4
|
+
data.tar.gz: 73246ebbee194ecb946b8d4ed1f2bcd85d5bacab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d9f7c8ad4f5d0a0032f5df7399aa7f1d3ebd8e8be44aa691de864c9f43f27a2f4e8653bc1ec75b84f3605802edf130e30f1d6aa150da079369cf95e71080796
|
7
|
+
data.tar.gz: 0c796f612535723355b1eaef4bd5e2452ad61e331e1eb02a44c2fffe4e9e9ae69302711e430211ba9537d65016b361732f6231519c1c7568e8a8e6efc4f32e94
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,39 @@
|
|
1
|
+
## Rails 4.2.9.rc1 (June 13, 2017) ##
|
2
|
+
|
3
|
+
* Fixed bug in `DateAndTime::Compatibility#to_time` that caused it to
|
4
|
+
raise `RuntimeError: can't modify frozen Time` when called on any frozen `Time`.
|
5
|
+
Properly pass through the frozen `Time` or `ActiveSupport::TimeWithZone` object
|
6
|
+
when calling `#to_time`.
|
7
|
+
|
8
|
+
*Kevin McPhillips* & *Andrew White*
|
9
|
+
|
10
|
+
* Restore the return type of `DateTime#utc`
|
11
|
+
|
12
|
+
In Rails 5.0 the return type of `DateTime#utc` was changed to `Time` to be
|
13
|
+
consistent with the new `DateTime#localtime` method. When these changes were
|
14
|
+
backported in #27553 this inadvertently changed the return type in a patcn
|
15
|
+
release. Since `DateTime#localtime` was new in Rails 4.2.8 it's okay to
|
16
|
+
restore the return type of `DateTime#utc` but keep `DateTime#localtime` as
|
17
|
+
returning `Time` without breaking backwards compatibility.
|
18
|
+
|
19
|
+
*Andrew White*
|
20
|
+
|
21
|
+
* In Core Extensions, make `MarshalWithAutoloading#load` pass through the second, optional
|
22
|
+
argument for `Marshal#load( source [, proc] )`. This way we don't have to do
|
23
|
+
`Marshal.method(:load).super_method.call(sourse, proc)` just to be able to pass a proc.
|
24
|
+
|
25
|
+
*Jeff Latz*
|
26
|
+
|
27
|
+
* Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing.
|
28
|
+
|
29
|
+
*Adam Rice*
|
30
|
+
|
31
|
+
* `AS::Testing::TimeHelpers#travel_to` now changes `DateTime.now` as well as
|
32
|
+
`Time.now` and `Date.today`.
|
33
|
+
|
34
|
+
*Yuki Nishijima*
|
35
|
+
|
36
|
+
|
1
37
|
## Rails 4.2.8 (February 21, 2017) ##
|
2
38
|
|
3
39
|
* Make `getlocal` and `getutc` always return instances of `Time` for
|
@@ -11,19 +11,5 @@ module DateAndTime
|
|
11
11
|
# this behavior, but new apps will have an initializer that sets
|
12
12
|
# this to true, because the new behavior is preferred.
|
13
13
|
mattr_accessor(:preserve_timezone, instance_writer: false) { false }
|
14
|
-
|
15
|
-
def self.included(base)
|
16
|
-
base.class_eval do
|
17
|
-
remove_possible_method :to_time
|
18
|
-
|
19
|
-
def to_time
|
20
|
-
if preserve_timezone
|
21
|
-
@_to_time_with_instance_offset ||= getlocal(utc_offset)
|
22
|
-
else
|
23
|
-
@_to_time_with_system_offset ||= getlocal
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
14
|
end
|
29
15
|
end
|
@@ -157,17 +157,12 @@ class DateTime
|
|
157
157
|
end
|
158
158
|
alias_method :getlocal, :localtime
|
159
159
|
|
160
|
-
# Returns a <tt>
|
160
|
+
# Returns a <tt>DateTime</tt> instance of the simultaneous time in the UTC timezone.
|
161
161
|
#
|
162
162
|
# DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)) # => Mon, 21 Feb 2005 10:11:12 -0600
|
163
163
|
# DateTime.civil(2005, 2, 21, 10, 11, 12, Rational(-6, 24)).utc # => Mon, 21 Feb 2005 16:11:12 UTC
|
164
164
|
def utc
|
165
|
-
|
166
|
-
|
167
|
-
Time.utc(
|
168
|
-
utc.year, utc.month, utc.day,
|
169
|
-
utc.hour, utc.min, utc.sec + utc.sec_fraction
|
170
|
-
)
|
165
|
+
new_offset(0)
|
171
166
|
end
|
172
167
|
alias_method :getgm, :utc
|
173
168
|
alias_method :getutc, :utc
|
@@ -2,4 +2,14 @@ require 'active_support/core_ext/date_and_time/compatibility'
|
|
2
2
|
|
3
3
|
class DateTime
|
4
4
|
include DateAndTime::Compatibility
|
5
|
+
|
6
|
+
remove_possible_method :to_time
|
7
|
+
|
8
|
+
# Either return an instance of `Time` with the same UTC offset
|
9
|
+
# as +self+ or an instance of `Time` representing the same time
|
10
|
+
# in the the local system timezone depending on the setting of
|
11
|
+
# on the setting of +ActiveSupport.to_time_preserves_timezone+.
|
12
|
+
def to_time
|
13
|
+
preserve_timezone ? getlocal(utc_offset) : getlocal
|
14
|
+
end
|
5
15
|
end
|
@@ -2,8 +2,8 @@ require 'active_support/core_ext/module/aliasing'
|
|
2
2
|
|
3
3
|
module Marshal
|
4
4
|
class << self
|
5
|
-
def load_with_autoloading(source)
|
6
|
-
load_without_autoloading(source)
|
5
|
+
def load_with_autoloading(source, proc = nil)
|
6
|
+
load_without_autoloading(source, proc)
|
7
7
|
rescue ArgumentError, NameError => exc
|
8
8
|
if exc.message.match(%r|undefined class/module (.+?)(::)?\z|)
|
9
9
|
# try loading the class/module
|
@@ -257,7 +257,9 @@ class Time
|
|
257
257
|
# can be chronologically compared with a Time
|
258
258
|
def compare_with_coercion(other)
|
259
259
|
# we're avoiding Time#to_datetime cause it's expensive
|
260
|
-
if other.
|
260
|
+
if other.class == Time
|
261
|
+
compare_without_coercion(other)
|
262
|
+
elsif other.is_a?(Time)
|
261
263
|
compare_without_coercion(other.to_time)
|
262
264
|
else
|
263
265
|
to_datetime <=> other
|
@@ -1,5 +1,14 @@
|
|
1
|
-
require
|
1
|
+
require "active_support/core_ext/date_and_time/compatibility"
|
2
|
+
require "active_support/core_ext/module/remove_method"
|
2
3
|
|
3
4
|
class Time
|
4
5
|
include DateAndTime::Compatibility
|
6
|
+
|
7
|
+
remove_possible_method :to_time
|
8
|
+
|
9
|
+
# Either return +self+ or the time in the local system timezone depending
|
10
|
+
# on the setting of +ActiveSupport.to_time_preserves_timezone+.
|
11
|
+
def to_time
|
12
|
+
preserve_timezone ? self : getlocal
|
13
|
+
end
|
5
14
|
end
|
@@ -8,6 +8,17 @@ module ActiveSupport
|
|
8
8
|
include ActiveSupport::LoggerThreadSafeLevel
|
9
9
|
include LoggerSilence
|
10
10
|
|
11
|
+
# Returns true if the logger destination matches one of the sources
|
12
|
+
#
|
13
|
+
# logger = Logger.new(STDOUT)
|
14
|
+
# ActiveSupport::Logger.logger_outputs_to?(logger, STDOUT)
|
15
|
+
# # => true
|
16
|
+
def self.logger_outputs_to?(logger, *sources)
|
17
|
+
logdev = logger.instance_variable_get("@logdev")
|
18
|
+
logger_source = logdev.dev if logdev.respond_to?(:dev)
|
19
|
+
sources.any? { |source| source == logger_source }
|
20
|
+
end
|
21
|
+
|
11
22
|
# Broadcasts logs to multiple loggers.
|
12
23
|
def self.broadcast(logger) # :nodoc:
|
13
24
|
Module.new do
|
@@ -42,12 +42,13 @@ module ActiveSupport
|
|
42
42
|
# Containing helpers that helps you test passage of time.
|
43
43
|
module TimeHelpers
|
44
44
|
# Changes current time to the time in the future or in the past by a given time difference by
|
45
|
-
# stubbing +Time.now+ and +
|
45
|
+
# stubbing +Time.now+, +Date.today+, and +DateTime.now+.
|
46
46
|
#
|
47
|
-
# Time.current
|
47
|
+
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
|
48
48
|
# travel 1.day
|
49
|
-
# Time.current
|
50
|
-
# Date.current
|
49
|
+
# Time.current # => Sun, 10 Nov 2013 15:34:49 EST -05:00
|
50
|
+
# Date.current # => Sun, 10 Nov 2013
|
51
|
+
# DateTime.current # => Sun, 10 Nov 2013 15:34:49 -0500
|
51
52
|
#
|
52
53
|
# This method also accepts a block, which will return the current time back to its original
|
53
54
|
# state at the end of the block:
|
@@ -61,13 +62,14 @@ module ActiveSupport
|
|
61
62
|
travel_to Time.now + duration, &block
|
62
63
|
end
|
63
64
|
|
64
|
-
# Changes current time to the given time by stubbing +Time.now
|
65
|
-
# +Date.today+ to return the time or date passed into this method.
|
65
|
+
# Changes current time to the given time by stubbing +Time.now+,
|
66
|
+
# +Date.today+, and +DateTime.now+ to return the time or date passed into this method.
|
66
67
|
#
|
67
|
-
# Time.current
|
68
|
+
# Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
|
68
69
|
# travel_to Time.new(2004, 11, 24, 01, 04, 44)
|
69
|
-
# Time.current
|
70
|
-
# Date.current
|
70
|
+
# Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
|
71
|
+
# Date.current # => Wed, 24 Nov 2004
|
72
|
+
# DateTime.current # => Wed, 24 Nov 2004 01:04:44 -0500
|
71
73
|
#
|
72
74
|
# Dates are taken as their timestamp at the beginning of the day in the
|
73
75
|
# application time zone. <tt>Time.current</tt> returns said timestamp,
|
@@ -326,6 +326,17 @@ module ActiveSupport
|
|
326
326
|
@to_datetime ||= utc.to_datetime.new_offset(Rational(utc_offset, 86_400))
|
327
327
|
end
|
328
328
|
|
329
|
+
# Returns an instance of +Time+, either with the same UTC offset
|
330
|
+
# as +self+ or in the local system timezone depending on the setting
|
331
|
+
# of +ActiveSupport.to_time_preserves_timezone+.
|
332
|
+
def to_time
|
333
|
+
if preserve_timezone
|
334
|
+
@to_time_with_instance_offset ||= getlocal(utc_offset)
|
335
|
+
else
|
336
|
+
@to_time_with_system_offset ||= getlocal
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
329
340
|
# So that +self+ <tt>acts_like?(:time)</tt>.
|
330
341
|
def acts_like_time?
|
331
342
|
true
|
@@ -338,7 +349,8 @@ module ActiveSupport
|
|
338
349
|
alias_method :kind_of?, :is_a?
|
339
350
|
|
340
351
|
def freeze
|
341
|
-
|
352
|
+
# preload instance variables before freezing
|
353
|
+
period; utc; time; to_datetime; to_time
|
342
354
|
super
|
343
355
|
end
|
344
356
|
|
@@ -66,12 +66,9 @@ module ActiveSupport
|
|
66
66
|
data = StringIO.new(data || '')
|
67
67
|
end
|
68
68
|
|
69
|
-
|
70
|
-
if char.nil?
|
69
|
+
if data.eof?
|
71
70
|
{}
|
72
71
|
else
|
73
|
-
data.ungetc(char)
|
74
|
-
|
75
72
|
LibXML::XML::Error.set_handler(&LibXML::XML::Error::QUIET_HANDLER)
|
76
73
|
parser = LibXML::XML::SaxParser.io(data)
|
77
74
|
document = self.document_class.new
|
@@ -72,11 +72,9 @@ module ActiveSupport
|
|
72
72
|
data = StringIO.new(data || '')
|
73
73
|
end
|
74
74
|
|
75
|
-
|
76
|
-
if char.nil?
|
75
|
+
if data.eof?
|
77
76
|
{}
|
78
77
|
else
|
79
|
-
data.ungetc(char)
|
80
78
|
document = self.document_class.new
|
81
79
|
parser = Nokogiri::XML::SAX::Parser.new(document)
|
82
80
|
parser.parse(data)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activesupport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.9.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -318,12 +318,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
318
318
|
version: 1.9.3
|
319
319
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
320
320
|
requirements:
|
321
|
-
- - "
|
321
|
+
- - ">"
|
322
322
|
- !ruby/object:Gem::Version
|
323
|
-
version:
|
323
|
+
version: 1.3.1
|
324
324
|
requirements: []
|
325
325
|
rubyforge_project:
|
326
|
-
rubygems_version: 2.6.
|
326
|
+
rubygems_version: 2.6.12
|
327
327
|
signing_key:
|
328
328
|
specification_version: 4
|
329
329
|
summary: A toolkit of support libraries and Ruby core extensions extracted from the
|