activesupport 7.2.0.beta1 → 7.2.0.beta2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -12
- data/lib/active_support/broadcast_logger.rb +1 -0
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +36 -12
- data/lib/active_support/core_ext/date_time/compatibility.rb +5 -3
- data/lib/active_support/core_ext/digest/uuid.rb +6 -0
- data/lib/active_support/core_ext/module/attr_internal.rb +1 -1
- data/lib/active_support/core_ext/time/compatibility.rb +3 -2
- data/lib/active_support/deprecation/reporting.rb +1 -1
- data/lib/active_support/deprecation.rb +1 -1
- data/lib/active_support/gem_version.rb +1 -1
- data/lib/active_support/proxy_object.rb +1 -1
- data/lib/active_support/time_with_zone.rb +8 -3
- data/lib/active_support.rb +8 -6
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64a68e8272dc370b1b26c76cfc52990f1d55b0356e177baa1f6b913bf0064945
|
4
|
+
data.tar.gz: 57262080af9d7a9727fb2ac430f2fdeefd98714c0c47c899af1ea3a3f5ac445e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 145d66aa10855ae55249f6c29e8680406835c79bc1f1f8dc8d1ec6c254f2c985c7de7369760c336df537120de83d05ef20dc9c7b6426110b19a3eb717d2d9415
|
7
|
+
data.tar.gz: ad780c985f5f24a1aba645ae0b9c5c425ee0dd872ddc7cc44646e6febabba0505d1f18a841fc95e1db894a7069fc884e32a7883607085c7b0a77560799ed0bb5
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## Rails 7.2.0.beta2 (June 04, 2024) ##
|
2
|
+
|
3
|
+
* Define `Digest::UUID.nil_uuid`, which returns the so-called nil UUID.
|
4
|
+
|
5
|
+
*Xavier Noria*
|
6
|
+
|
1
7
|
## Rails 7.2.0.beta1 (May 29, 2024) ##
|
2
8
|
|
3
9
|
* Support `duration` type in `ActiveSupport::XmlMini`.
|
@@ -122,18 +128,6 @@
|
|
122
128
|
|
123
129
|
*Sean Doyle*
|
124
130
|
|
125
|
-
* Remove deprecated support for the pre-Ruby 2.4 behavior of `to_time` returning a `Time` object with local timezone.
|
126
|
-
|
127
|
-
*Rafael Mendonça França*
|
128
|
-
|
129
|
-
* Deprecate `config.active_support.to_time_preserves_timezone`.
|
130
|
-
|
131
|
-
*Rafael Mendonça França*
|
132
|
-
|
133
|
-
* Deprecate `DateAndTime::Compatibility.preserve_timezone`.
|
134
|
-
|
135
|
-
*Rafael Mendonça França*
|
136
|
-
|
137
131
|
* Yield instance to `Object#with` block.
|
138
132
|
|
139
133
|
```ruby
|
@@ -1,9 +1,45 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "active_support/core_ext/module/attribute_accessors"
|
4
|
+
require "active_support/core_ext/module/redefine_method"
|
4
5
|
|
5
6
|
module DateAndTime
|
6
7
|
module Compatibility
|
8
|
+
# If true, +to_time+ preserves the timezone offset of receiver.
|
9
|
+
#
|
10
|
+
# NOTE: With Ruby 2.4+ the default for +to_time+ changed from
|
11
|
+
# converting to the local system time, to preserving the offset
|
12
|
+
# of the receiver. For backwards compatibility we're overriding
|
13
|
+
# this behavior, but new apps will have an initializer that sets
|
14
|
+
# this to true, because the new behavior is preferred.
|
15
|
+
mattr_accessor :preserve_timezone, instance_accessor: false, default: nil
|
16
|
+
|
17
|
+
singleton_class.silence_redefinition_of_method :preserve_timezone
|
18
|
+
|
19
|
+
#--
|
20
|
+
# This re-implements the behaviour of the mattr_reader, instead
|
21
|
+
# of prepending on to it, to avoid overcomplicating a module that
|
22
|
+
# is in turn included in several places. This will all go away in
|
23
|
+
# Rails 8.0 anyway.
|
24
|
+
def self.preserve_timezone # :nodoc:
|
25
|
+
if @@preserve_timezone.nil?
|
26
|
+
# Only warn once, the first time the value is used (which should
|
27
|
+
# be the first time #to_time is called).
|
28
|
+
ActiveSupport.deprecator.warn(
|
29
|
+
"to_time will always preserve the timezone offset of the receiver in Rails 8.0. " \
|
30
|
+
"To opt in to the new behavior, set `ActiveSupport.to_time_preserves_timezone = true`."
|
31
|
+
)
|
32
|
+
|
33
|
+
@@preserve_timezone = false
|
34
|
+
end
|
35
|
+
|
36
|
+
@@preserve_timezone
|
37
|
+
end
|
38
|
+
|
39
|
+
def preserve_timezone # :nodoc:
|
40
|
+
Compatibility.preserve_timezone
|
41
|
+
end
|
42
|
+
|
7
43
|
# Change the output of <tt>ActiveSupport::TimeZone.utc_to_local</tt>.
|
8
44
|
#
|
9
45
|
# When +true+, it returns local times with a UTC offset, with +false+ local
|
@@ -18,17 +54,5 @@ module DateAndTime
|
|
18
54
|
# # With `utc_to_local_returns_utc_offset_times = true`, local time is returned with UTC offset:
|
19
55
|
# zone.utc_to_local(Time.utc(2000, 1)) # => 1999-12-31 19:00:00 -0500
|
20
56
|
mattr_accessor :utc_to_local_returns_utc_offset_times, instance_writer: false, default: false
|
21
|
-
|
22
|
-
def self.preserve_timezone
|
23
|
-
ActiveSupport.deprecator.warn(
|
24
|
-
"`DateAndTime::Compatibility.preserve_timezone` has been deprecated and will be removed in Rails 7.3."
|
25
|
-
)
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.preserve_timezone=(value)
|
29
|
-
ActiveSupport.deprecator.warn(
|
30
|
-
"`DateAndTime::Compatibility.preserve_timezone=` has been deprecated and will be removed in Rails 7.3."
|
31
|
-
)
|
32
|
-
end
|
33
57
|
end
|
34
58
|
end
|
@@ -8,9 +8,11 @@ class DateTime
|
|
8
8
|
|
9
9
|
silence_redefinition_of_method :to_time
|
10
10
|
|
11
|
-
#
|
12
|
-
# as +self
|
11
|
+
# Either return an instance of +Time+ with the same UTC offset
|
12
|
+
# as +self+ or an instance of +Time+ representing the same time
|
13
|
+
# in the local system timezone depending on the setting of
|
14
|
+
# on the setting of +ActiveSupport.to_time_preserves_timezone+.
|
13
15
|
def to_time
|
14
|
-
getlocal(utc_offset)
|
16
|
+
preserve_timezone ? getlocal(utc_offset) : getlocal
|
15
17
|
end
|
16
18
|
end
|
@@ -53,6 +53,12 @@ module Digest
|
|
53
53
|
SecureRandom.uuid
|
54
54
|
end
|
55
55
|
|
56
|
+
# Returns the nil UUID. This is a special form of UUID that is specified to
|
57
|
+
# have all 128 bits set to zero.
|
58
|
+
def self.nil_uuid
|
59
|
+
"00000000-0000-0000-0000-000000000000"
|
60
|
+
end
|
61
|
+
|
56
62
|
def self.pack_uuid_namespace(namespace)
|
57
63
|
if [DNS_NAMESPACE, OID_NAMESPACE, URL_NAMESPACE, X500_NAMESPACE].include?(namespace)
|
58
64
|
namespace
|
@@ -25,7 +25,7 @@ class Module
|
|
25
25
|
def attr_internal_naming_format=(format)
|
26
26
|
if format.start_with?("@")
|
27
27
|
ActiveSupport.deprecator.warn <<~MESSAGE
|
28
|
-
Setting `attr_internal_naming_format` with a `@` prefix is deprecated and will be removed in Rails
|
28
|
+
Setting `attr_internal_naming_format` with a `@` prefix is deprecated and will be removed in Rails 8.0.
|
29
29
|
|
30
30
|
You can simply replace #{format.inspect} by #{format.delete_prefix("@").inspect}.
|
31
31
|
MESSAGE
|
@@ -8,8 +8,9 @@ class Time
|
|
8
8
|
|
9
9
|
silence_redefinition_of_method :to_time
|
10
10
|
|
11
|
-
#
|
11
|
+
# Either return +self+ or the time in the local system timezone depending
|
12
|
+
# on the setting of +ActiveSupport.to_time_preserves_timezone+.
|
12
13
|
def to_time
|
13
|
-
self
|
14
|
+
preserve_timezone ? self : getlocal
|
14
15
|
end
|
15
16
|
end
|
@@ -152,7 +152,7 @@ module ActiveSupport
|
|
152
152
|
|
153
153
|
def _extract_callstack(callstack)
|
154
154
|
ActiveSupport.deprecator.warn(<<~MESSAGE)
|
155
|
-
Passing the result of `caller` to ActiveSupport::Deprecation#warn is deprecated and will be removed in Rails
|
155
|
+
Passing the result of `caller` to ActiveSupport::Deprecation#warn is deprecated and will be removed in Rails 8.0.
|
156
156
|
|
157
157
|
Please pass the result of `caller_locations` instead.
|
158
158
|
MESSAGE
|
@@ -68,7 +68,7 @@ module ActiveSupport
|
|
68
68
|
# and the second is a library name.
|
69
69
|
#
|
70
70
|
# ActiveSupport::Deprecation.new('2.0', 'MyLibrary')
|
71
|
-
def initialize(deprecation_horizon = "
|
71
|
+
def initialize(deprecation_horizon = "8.0", gem_name = "Rails")
|
72
72
|
self.gem_name = gem_name
|
73
73
|
self.deprecation_horizon = deprecation_horizon
|
74
74
|
# By default, warnings are not silenced and debugging is off.
|
@@ -12,7 +12,7 @@ module ActiveSupport
|
|
12
12
|
|
13
13
|
def self.inherited(_subclass)
|
14
14
|
::ActiveSupport.deprecator.warn(<<~MSG)
|
15
|
-
ActiveSupport::ProxyObject is deprecated and will be removed in Rails
|
15
|
+
ActiveSupport::ProxyObject is deprecated and will be removed in Rails 8.0.
|
16
16
|
Use Ruby's built-in BasicObject instead.
|
17
17
|
MSG
|
18
18
|
end
|
@@ -479,10 +479,15 @@ module ActiveSupport
|
|
479
479
|
@to_datetime ||= utc.to_datetime.new_offset(Rational(utc_offset, 86_400))
|
480
480
|
end
|
481
481
|
|
482
|
-
# Returns an instance of +Time
|
483
|
-
# as +self
|
482
|
+
# Returns an instance of +Time+, either with the same UTC offset
|
483
|
+
# as +self+ or in the local system timezone depending on the setting
|
484
|
+
# of +ActiveSupport.to_time_preserves_timezone+.
|
484
485
|
def to_time
|
485
|
-
|
486
|
+
if preserve_timezone
|
487
|
+
@to_time_with_instance_offset ||= getlocal(utc_offset)
|
488
|
+
else
|
489
|
+
@to_time_with_system_offset ||= getlocal
|
490
|
+
end
|
486
491
|
end
|
487
492
|
|
488
493
|
# So that +self+ <tt>acts_like?(:time)</tt>.
|
data/lib/active_support.rb
CHANGED
@@ -111,15 +111,17 @@ module ActiveSupport
|
|
111
111
|
end
|
112
112
|
|
113
113
|
def self.to_time_preserves_timezone
|
114
|
-
|
115
|
-
"`config.active_support.to_time_preserves_timezone` has been deprecated and will be removed in Rails 7.3."
|
116
|
-
)
|
114
|
+
DateAndTime::Compatibility.preserve_timezone
|
117
115
|
end
|
118
116
|
|
119
117
|
def self.to_time_preserves_timezone=(value)
|
120
|
-
|
121
|
-
|
122
|
-
|
118
|
+
unless value
|
119
|
+
ActiveSupport.deprecator.warn(
|
120
|
+
"Support for the pre-Ruby 2.4 behavior of to_time has been deprecated and will be removed in Rails 8.0."
|
121
|
+
)
|
122
|
+
end
|
123
|
+
|
124
|
+
DateAndTime::Compatibility.preserve_timezone = value
|
123
125
|
end
|
124
126
|
|
125
127
|
def self.utc_to_local_returns_utc_offset_times
|
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: 7.2.0.
|
4
|
+
version: 7.2.0.beta2
|
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: 2024-
|
11
|
+
date: 2024-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -438,10 +438,10 @@ licenses:
|
|
438
438
|
- MIT
|
439
439
|
metadata:
|
440
440
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
441
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.2.0.
|
442
|
-
documentation_uri: https://api.rubyonrails.org/v7.2.0.
|
441
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.2.0.beta2/activesupport/CHANGELOG.md
|
442
|
+
documentation_uri: https://api.rubyonrails.org/v7.2.0.beta2/
|
443
443
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
444
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.2.0.
|
444
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.2.0.beta2/activesupport
|
445
445
|
rubygems_mfa_required: 'true'
|
446
446
|
post_install_message:
|
447
447
|
rdoc_options:
|
@@ -456,11 +456,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
456
456
|
version: 3.1.0
|
457
457
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
458
458
|
requirements:
|
459
|
-
- - "
|
459
|
+
- - ">"
|
460
460
|
- !ruby/object:Gem::Version
|
461
|
-
version:
|
461
|
+
version: 1.3.1
|
462
462
|
requirements: []
|
463
|
-
rubygems_version: 3.
|
463
|
+
rubygems_version: 3.3.27
|
464
464
|
signing_key:
|
465
465
|
specification_version: 4
|
466
466
|
summary: A toolkit of support libraries and Ruby core extensions extracted from the
|