activesupport 7.1.3.4 → 7.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +62 -0
- data/lib/active_support/backtrace_cleaner.rb +5 -0
- data/lib/active_support/broadcast_logger.rb +1 -0
- data/lib/active_support/cache.rb +2 -1
- data/lib/active_support/code_generator.rb +15 -10
- data/lib/active_support/core_ext/module/delegation.rb +41 -26
- data/lib/active_support/core_ext/object/duplicable.rb +24 -15
- data/lib/active_support/gem_version.rb +2 -2
- data/lib/active_support/html_safe_translation.rb +4 -4
- data/lib/active_support/json/encoding.rb +1 -1
- data/lib/active_support/log_subscriber.rb +1 -0
- data/lib/active_support/messages/codec.rb +1 -1
- data/lib/active_support/notifications/instrumenter.rb +11 -3
- data/lib/active_support/railtie.rb +3 -3
- data/lib/active_support/syntax_error_proxy.rb +1 -11
- data/lib/active_support/tagged_logging.rb +4 -0
- data/lib/active_support/testing/setup_and_teardown.rb +2 -0
- data/lib/active_support/values/time_zone.rb +9 -0
- data/lib/active_support.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6491de42f1e47d5b95e165153c3f0a3f81a4272dfebb2b468e79b4969fcd209
|
4
|
+
data.tar.gz: 1f3e7be1f2908700731f6bc5d640c47a962aa02a119f44f1dfa22d19dc8967be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90acc22363f45e1c1c136147ff75138d32e9835ed2ae16bf76f2e624d298946f0f11933350cc0af08c49a13bb9f2aa960f7f3b36cf2cb4e9cc9fe9c2bf6a268b
|
7
|
+
data.tar.gz: 0e7556395820516ae7b7e94b87ab77ff5dea67de55685a9077747c149f97f725ecef62d38d33e07d85486ac7233b055004cca68fe779d18eba77e2e3f4e04522
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,65 @@
|
|
1
|
+
## Rails 7.1.4 (August 22, 2024) ##
|
2
|
+
|
3
|
+
* Improve compatibility for `ActiveSupport::BroadcastLogger`.
|
4
|
+
|
5
|
+
*Máximo Mussini*
|
6
|
+
|
7
|
+
* Pass options along to write_entry in handle_expired_entry method.
|
8
|
+
|
9
|
+
*Graham Cooper*
|
10
|
+
|
11
|
+
* Fix Active Support configurations deprecations.
|
12
|
+
|
13
|
+
*fatkodima*
|
14
|
+
|
15
|
+
* Fix teardown callbacks.
|
16
|
+
|
17
|
+
*Tristan Starck*
|
18
|
+
|
19
|
+
* `BacktraceCleaner` silence core internal methods by default.
|
20
|
+
|
21
|
+
*Jean Boussier*
|
22
|
+
|
23
|
+
* Fix `delegate_missing_to allow_nil: true` when called with implict self
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
class Person
|
27
|
+
delegate_missing_to :address, allow_nil: true
|
28
|
+
|
29
|
+
def address
|
30
|
+
nil
|
31
|
+
end
|
32
|
+
|
33
|
+
def berliner?
|
34
|
+
city == "Berlin"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Person.new.city # => nil
|
39
|
+
Person.new.berliner? # undefined local variable or method `city' for an instance of Person (NameError)
|
40
|
+
```
|
41
|
+
|
42
|
+
*Jean Boussier*
|
43
|
+
|
44
|
+
* Work around a Ruby bug that can cause a VM crash.
|
45
|
+
|
46
|
+
This would happen if using `TaggerLogger` with a Proc
|
47
|
+
formatter on which you called `object_id`.
|
48
|
+
|
49
|
+
```
|
50
|
+
[BUG] Object ID seen, but not in mapping table: proc
|
51
|
+
```
|
52
|
+
|
53
|
+
*Jean Boussier*
|
54
|
+
|
55
|
+
* Fix `ActiveSupport::Notifications.publish_event` to preserve units.
|
56
|
+
|
57
|
+
This solves the incorrect reporting of time spent running Active Record
|
58
|
+
asynchronous queries (by a factor `1000`).
|
59
|
+
|
60
|
+
*Jean Boussier*
|
61
|
+
|
62
|
+
|
1
63
|
## Rails 7.1.3.4 (June 04, 2024) ##
|
2
64
|
|
3
65
|
* No changes.
|
@@ -33,6 +33,7 @@ module ActiveSupport
|
|
33
33
|
class BacktraceCleaner
|
34
34
|
def initialize
|
35
35
|
@filters, @silencers = [], []
|
36
|
+
add_core_silencer
|
36
37
|
add_gem_filter
|
37
38
|
add_gem_silencer
|
38
39
|
add_stdlib_silencer
|
@@ -116,6 +117,10 @@ module ActiveSupport
|
|
116
117
|
add_filter { |line| line.sub(gems_regexp, gems_result) }
|
117
118
|
end
|
118
119
|
|
120
|
+
def add_core_silencer
|
121
|
+
add_silencer { |line| line.include?("<internal:") }
|
122
|
+
end
|
123
|
+
|
119
124
|
def add_gem_silencer
|
120
125
|
add_silencer { |line| FORMATTED_GEMS_PATTERN.match?(line) }
|
121
126
|
end
|
data/lib/active_support/cache.rb
CHANGED
@@ -1038,7 +1038,8 @@ module ActiveSupport
|
|
1038
1038
|
# When an entry has a positive :race_condition_ttl defined, put the stale entry back into the cache
|
1039
1039
|
# for a brief period while the entry is being recalculated.
|
1040
1040
|
entry.expires_at = Time.now.to_f + race_ttl
|
1041
|
-
|
1041
|
+
options[:expires_in] = race_ttl * 2
|
1042
|
+
write_entry(key, entry, **options)
|
1042
1043
|
else
|
1043
1044
|
delete_entry(key, **options)
|
1044
1045
|
end
|
@@ -9,16 +9,19 @@ module ActiveSupport
|
|
9
9
|
@cache = METHOD_CACHES[namespace]
|
10
10
|
@sources = []
|
11
11
|
@methods = {}
|
12
|
+
@canonical_methods = {}
|
12
13
|
end
|
13
14
|
|
14
|
-
def define_cached_method(
|
15
|
-
|
16
|
-
as = as.to_sym
|
17
|
-
|
18
|
-
|
15
|
+
def define_cached_method(canonical_name, as: nil)
|
16
|
+
canonical_name = canonical_name.to_sym
|
17
|
+
as = (as || canonical_name).to_sym
|
18
|
+
|
19
|
+
@methods.fetch(as) do
|
20
|
+
unless @cache.method_defined?(canonical_name) || @canonical_methods[canonical_name]
|
19
21
|
yield @sources
|
20
22
|
end
|
21
|
-
@
|
23
|
+
@canonical_methods[canonical_name] = true
|
24
|
+
@methods[as] = canonical_name
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
@@ -26,8 +29,10 @@ module ActiveSupport
|
|
26
29
|
unless @sources.empty?
|
27
30
|
@cache.module_eval("# frozen_string_literal: true\n" + @sources.join(";"), path, line)
|
28
31
|
end
|
29
|
-
@
|
30
|
-
|
32
|
+
@canonical_methods.clear
|
33
|
+
|
34
|
+
@methods.each do |as, canonical_name|
|
35
|
+
owner.define_method(as, @cache.instance_method(canonical_name))
|
31
36
|
end
|
32
37
|
end
|
33
38
|
end
|
@@ -52,8 +57,8 @@ module ActiveSupport
|
|
52
57
|
@namespaces = Hash.new { |h, k| h[k] = MethodSet.new(k) }
|
53
58
|
end
|
54
59
|
|
55
|
-
def define_cached_method(
|
56
|
-
@namespaces[namespace].define_cached_method(
|
60
|
+
def define_cached_method(canonical_name, namespace:, as: nil, &block)
|
61
|
+
@namespaces[namespace].define_cached_method(canonical_name, as: as, &block)
|
57
62
|
end
|
58
63
|
|
59
64
|
def execute
|
@@ -317,37 +317,52 @@ class Module
|
|
317
317
|
# of <tt>object</tt> add or remove instance variables.
|
318
318
|
def delegate_missing_to(target, allow_nil: nil)
|
319
319
|
target = target.to_s
|
320
|
-
target = "self.#{target}" if DELEGATION_RESERVED_METHOD_NAMES.include?(target)
|
320
|
+
target = "self.#{target}" if DELEGATION_RESERVED_METHOD_NAMES.include?(target) || target == "__target"
|
321
321
|
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
322
|
+
if allow_nil
|
323
|
+
module_eval <<~RUBY, __FILE__, __LINE__ + 1
|
324
|
+
def respond_to_missing?(name, include_private = false)
|
325
|
+
# It may look like an oversight, but we deliberately do not pass
|
326
|
+
# +include_private+, because they do not get delegated.
|
326
327
|
|
327
|
-
|
328
|
-
|
329
|
-
|
328
|
+
return false if name == :marshal_dump || name == :_dump
|
329
|
+
#{target}.respond_to?(name) || super
|
330
|
+
end
|
330
331
|
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
332
|
+
def method_missing(method, *args, &block)
|
333
|
+
__target = #{target}
|
334
|
+
if __target.nil? && !nil.respond_to?(method)
|
335
|
+
nil
|
336
|
+
elsif __target.respond_to?(method)
|
337
|
+
__target.public_send(method, *args, &block)
|
338
|
+
else
|
336
339
|
super
|
337
|
-
rescue NoMethodError
|
338
|
-
if #{target}.nil?
|
339
|
-
if #{allow_nil == true}
|
340
|
-
nil
|
341
|
-
else
|
342
|
-
raise DelegationError, "\#{method} delegated to #{target}, but #{target} is nil"
|
343
|
-
end
|
344
|
-
else
|
345
|
-
raise
|
346
|
-
end
|
347
340
|
end
|
348
341
|
end
|
349
|
-
|
350
|
-
|
351
|
-
|
342
|
+
ruby2_keywords(:method_missing)
|
343
|
+
RUBY
|
344
|
+
else
|
345
|
+
module_eval <<~RUBY, __FILE__, __LINE__ + 1
|
346
|
+
def respond_to_missing?(name, include_private = false)
|
347
|
+
# It may look like an oversight, but we deliberately do not pass
|
348
|
+
# +include_private+, because they do not get delegated.
|
349
|
+
|
350
|
+
return false if name == :marshal_dump || name == :_dump
|
351
|
+
#{target}.respond_to?(name) || super
|
352
|
+
end
|
353
|
+
|
354
|
+
def method_missing(method, *args, &block)
|
355
|
+
__target = #{target}
|
356
|
+
if __target.nil? && !nil.respond_to?(method)
|
357
|
+
raise DelegationError, "\#{method} delegated to #{target}, but #{target} is nil"
|
358
|
+
elsif __target.respond_to?(method)
|
359
|
+
__target.public_send(method, *args, &block)
|
360
|
+
else
|
361
|
+
super
|
362
|
+
end
|
363
|
+
end
|
364
|
+
ruby2_keywords(:method_missing)
|
365
|
+
RUBY
|
366
|
+
end
|
352
367
|
end
|
353
368
|
end
|
@@ -28,23 +28,32 @@ class Object
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
def duplicable?
|
37
|
-
false
|
38
|
-
end
|
31
|
+
methods_are_duplicable = begin
|
32
|
+
Object.instance_method(:duplicable?).dup
|
33
|
+
true
|
34
|
+
rescue TypeError
|
35
|
+
false
|
39
36
|
end
|
40
37
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
38
|
+
unless methods_are_duplicable
|
39
|
+
class Method
|
40
|
+
# Methods are not duplicable:
|
41
|
+
#
|
42
|
+
# method(:puts).duplicable? # => false
|
43
|
+
# method(:puts).dup # => TypeError: allocator undefined for Method
|
44
|
+
def duplicable?
|
45
|
+
false
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class UnboundMethod
|
50
|
+
# Unbound methods are not duplicable:
|
51
|
+
#
|
52
|
+
# method(:puts).unbind.duplicable? # => false
|
53
|
+
# method(:puts).unbind.dup # => TypeError: allocator undefined for UnboundMethod
|
54
|
+
def duplicable?
|
55
|
+
false
|
56
|
+
end
|
48
57
|
end
|
49
58
|
end
|
50
59
|
|
@@ -24,11 +24,11 @@ module ActiveSupport
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
27
|
+
def html_safe_translation_key?(key)
|
28
|
+
/(?:_|\b)html\z/.match?(key)
|
29
|
+
end
|
31
30
|
|
31
|
+
private
|
32
32
|
def html_escape_translation_options(options)
|
33
33
|
options.each do |name, value|
|
34
34
|
unless i18n_option?(name) || (name == :count && value.is_a?(Numeric))
|
@@ -28,7 +28,7 @@ module ActiveSupport
|
|
28
28
|
|
29
29
|
def decode(encoded, url_safe: @url_safe)
|
30
30
|
url_safe ? ::Base64.urlsafe_decode64(encoded) : ::Base64.strict_decode64(encoded)
|
31
|
-
rescue
|
31
|
+
rescue StandardError => error
|
32
32
|
throw :invalid_message_format, error
|
33
33
|
end
|
34
34
|
|
@@ -104,7 +104,7 @@ module ActiveSupport
|
|
104
104
|
end
|
105
105
|
|
106
106
|
class Event
|
107
|
-
attr_reader :name, :
|
107
|
+
attr_reader :name, :transaction_id
|
108
108
|
attr_accessor :payload
|
109
109
|
|
110
110
|
def initialize(name, start, ending, transaction_id, payload)
|
@@ -119,7 +119,15 @@ module ActiveSupport
|
|
119
119
|
@allocation_count_finish = 0
|
120
120
|
end
|
121
121
|
|
122
|
-
def
|
122
|
+
def time
|
123
|
+
@time / 1000.0 if @time
|
124
|
+
end
|
125
|
+
|
126
|
+
def end
|
127
|
+
@end / 1000.0 if @end
|
128
|
+
end
|
129
|
+
|
130
|
+
def record # :nodoc:
|
123
131
|
start!
|
124
132
|
begin
|
125
133
|
yield payload if block_given?
|
@@ -195,7 +203,7 @@ module ActiveSupport
|
|
195
203
|
#
|
196
204
|
# @event.duration # => 1000.138
|
197
205
|
def duration
|
198
|
-
|
206
|
+
@end - @time
|
199
207
|
end
|
200
208
|
|
201
209
|
private
|
@@ -117,11 +117,11 @@ module ActiveSupport
|
|
117
117
|
|
118
118
|
initializer "active_support.set_configs" do |app|
|
119
119
|
app.config.active_support.each do |k, v|
|
120
|
-
if k ==
|
120
|
+
if k == :disable_to_s_conversion
|
121
121
|
ActiveSupport.deprecator.warn("config.active_support.disable_to_s_conversion is deprecated and will be removed in Rails 7.2.")
|
122
|
-
elsif k ==
|
122
|
+
elsif k == :remove_deprecated_time_with_zone_name
|
123
123
|
ActiveSupport.deprecator.warn("config.active_support.remove_deprecated_time_with_zone_name is deprecated and will be removed in Rails 7.2.")
|
124
|
-
elsif k ==
|
124
|
+
elsif k == :use_rfc4122_namespaced_uuids
|
125
125
|
ActiveSupport.deprecator.warn("config.active_support.use_rfc4122_namespaced_uuids is deprecated and will be removed in Rails 7.2.")
|
126
126
|
else
|
127
127
|
k = "#{k}="
|
@@ -45,7 +45,7 @@ module ActiveSupport
|
|
45
45
|
|
46
46
|
private
|
47
47
|
def parse_message_for_trace
|
48
|
-
if
|
48
|
+
if __getobj__.to_s.start_with?("(eval")
|
49
49
|
# If the exception is coming from a call to eval, we need to keep
|
50
50
|
# the path of the file in which eval was called to ensure we can
|
51
51
|
# return the right source fragment to show the location of the
|
@@ -56,15 +56,5 @@ module ActiveSupport
|
|
56
56
|
__getobj__.to_s.split("\n")
|
57
57
|
end
|
58
58
|
end
|
59
|
-
|
60
|
-
if SyntaxError.method_defined?(:path) # Ruby 3.3+
|
61
|
-
def source_location_eval?
|
62
|
-
__getobj__.path.start_with?("(eval")
|
63
|
-
end
|
64
|
-
else # 3.2 and older versions of Ruby
|
65
|
-
def source_location_eval?
|
66
|
-
__getobj__.to_s.start_with?("(eval")
|
67
|
-
end
|
68
|
-
end
|
69
59
|
end
|
70
60
|
end
|
@@ -119,6 +119,10 @@ module ActiveSupport
|
|
119
119
|
|
120
120
|
if logger.formatter
|
121
121
|
logger.formatter = logger.formatter.clone
|
122
|
+
|
123
|
+
# Workaround for https://bugs.ruby-lang.org/issues/20250
|
124
|
+
# Can be removed when Ruby 3.4 is the least supported version.
|
125
|
+
logger.formatter.object_id if logger.formatter.is_a?(Proc)
|
122
126
|
else
|
123
127
|
# Ensure we set a default formatter so we aren't extending nil!
|
124
128
|
logger.formatter = ActiveSupport::Logger::SimpleFormatter.new
|
@@ -208,7 +208,9 @@ module ActiveSupport
|
|
208
208
|
TZInfo::Timezone.get(MAPPING[name] || name)
|
209
209
|
end
|
210
210
|
|
211
|
+
# :stopdoc:
|
211
212
|
alias_method :create, :new
|
213
|
+
# :startdoc:
|
212
214
|
|
213
215
|
# Returns a TimeZone instance with the given name, or +nil+ if no
|
214
216
|
# such TimeZone instance exists. (This exists to support the use of
|
@@ -296,15 +298,22 @@ module ActiveSupport
|
|
296
298
|
attr_reader :name
|
297
299
|
attr_reader :tzinfo
|
298
300
|
|
301
|
+
##
|
302
|
+
# :singleton-method: create
|
303
|
+
# :call-seq: create(name, utc_offset = nil, tzinfo = nil)
|
304
|
+
#
|
299
305
|
# Create a new TimeZone object with the given name and offset. The
|
300
306
|
# offset is the number of seconds that this time zone is offset from UTC
|
301
307
|
# (GMT). Seconds were chosen as the offset unit because that is the unit
|
302
308
|
# that Ruby uses to represent time zone offsets (see Time#utc_offset).
|
309
|
+
|
310
|
+
# :stopdoc:
|
303
311
|
def initialize(name, utc_offset = nil, tzinfo = nil)
|
304
312
|
@name = name
|
305
313
|
@utc_offset = utc_offset
|
306
314
|
@tzinfo = tzinfo || TimeZone.find_tzinfo(name)
|
307
315
|
end
|
316
|
+
# :startdoc:
|
308
317
|
|
309
318
|
# Returns the offset of this time zone from UTC in seconds.
|
310
319
|
def utc_offset
|
data/lib/active_support.rb
CHANGED
@@ -32,7 +32,7 @@ require "active_support/broadcast_logger"
|
|
32
32
|
require "active_support/lazy_load_hooks"
|
33
33
|
require "active_support/core_ext/date_and_time/compatibility"
|
34
34
|
|
35
|
-
# :include:
|
35
|
+
# :include: ../README.rdoc
|
36
36
|
module ActiveSupport
|
37
37
|
extend ActiveSupport::Autoload
|
38
38
|
|
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.1.
|
4
|
+
version: 7.1.4
|
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-08-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -446,10 +446,10 @@ licenses:
|
|
446
446
|
- MIT
|
447
447
|
metadata:
|
448
448
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
449
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.1.
|
450
|
-
documentation_uri: https://api.rubyonrails.org/v7.1.
|
449
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.1.4/activesupport/CHANGELOG.md
|
450
|
+
documentation_uri: https://api.rubyonrails.org/v7.1.4/
|
451
451
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
452
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.1.
|
452
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.1.4/activesupport
|
453
453
|
rubygems_mfa_required: 'true'
|
454
454
|
post_install_message:
|
455
455
|
rdoc_options:
|
@@ -468,7 +468,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
468
468
|
- !ruby/object:Gem::Version
|
469
469
|
version: '0'
|
470
470
|
requirements: []
|
471
|
-
rubygems_version: 3.
|
471
|
+
rubygems_version: 3.5.11
|
472
472
|
signing_key:
|
473
473
|
specification_version: 4
|
474
474
|
summary: A toolkit of support libraries and Ruby core extensions extracted from the
|