activesupport 7.1.0 → 7.2.0

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.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +122 -943
  3. data/lib/active_support/array_inquirer.rb +1 -1
  4. data/lib/active_support/backtrace_cleaner.rb +15 -3
  5. data/lib/active_support/broadcast_logger.rb +33 -4
  6. data/lib/active_support/cache/entry.rb +7 -1
  7. data/lib/active_support/cache/file_store.rb +16 -11
  8. data/lib/active_support/cache/mem_cache_store.rb +32 -82
  9. data/lib/active_support/cache/memory_store.rb +17 -14
  10. data/lib/active_support/cache/redis_cache_store.rb +54 -36
  11. data/lib/active_support/cache/serializer_with_fallback.rb +0 -23
  12. data/lib/active_support/cache/strategy/local_cache.rb +9 -6
  13. data/lib/active_support/cache.rb +98 -84
  14. data/lib/active_support/callbacks.rb +74 -113
  15. data/lib/active_support/code_generator.rb +15 -10
  16. data/lib/active_support/core_ext/array/conversions.rb +0 -2
  17. data/lib/active_support/core_ext/class/subclasses.rb +15 -35
  18. data/lib/active_support/core_ext/date/blank.rb +4 -0
  19. data/lib/active_support/core_ext/date/conversions.rb +1 -3
  20. data/lib/active_support/core_ext/date_and_time/compatibility.rb +28 -1
  21. data/lib/active_support/core_ext/date_time/blank.rb +4 -0
  22. data/lib/active_support/core_ext/date_time/conversions.rb +0 -4
  23. data/lib/active_support/core_ext/digest/uuid.rb +6 -0
  24. data/lib/active_support/core_ext/erb/util.rb +5 -0
  25. data/lib/active_support/core_ext/hash/keys.rb +4 -4
  26. data/lib/active_support/core_ext/module/attr_internal.rb +17 -6
  27. data/lib/active_support/core_ext/module/concerning.rb +6 -6
  28. data/lib/active_support/core_ext/module/delegation.rb +20 -148
  29. data/lib/active_support/core_ext/module/deprecation.rb +1 -4
  30. data/lib/active_support/core_ext/numeric/conversions.rb +3 -3
  31. data/lib/active_support/core_ext/object/blank.rb +45 -1
  32. data/lib/active_support/core_ext/object/duplicable.rb +24 -15
  33. data/lib/active_support/core_ext/object/instance_variables.rb +11 -19
  34. data/lib/active_support/core_ext/object/json.rb +2 -2
  35. data/lib/active_support/core_ext/object/with.rb +5 -3
  36. data/lib/active_support/core_ext/object/with_options.rb +1 -1
  37. data/lib/active_support/core_ext/pathname/blank.rb +4 -0
  38. data/lib/active_support/core_ext/range/overlap.rb +1 -1
  39. data/lib/active_support/core_ext/securerandom.rb +8 -24
  40. data/lib/active_support/core_ext/string/conversions.rb +1 -1
  41. data/lib/active_support/core_ext/string/filters.rb +1 -1
  42. data/lib/active_support/core_ext/string/indent.rb +1 -1
  43. data/lib/active_support/core_ext/string/output_safety.rb +0 -7
  44. data/lib/active_support/core_ext/time/calculations.rb +18 -28
  45. data/lib/active_support/core_ext/time/compatibility.rb +16 -0
  46. data/lib/active_support/core_ext/time/conversions.rb +0 -2
  47. data/lib/active_support/core_ext.rb +0 -1
  48. data/lib/active_support/current_attributes.rb +33 -40
  49. data/lib/active_support/delegation.rb +202 -0
  50. data/lib/active_support/dependencies/autoload.rb +0 -12
  51. data/lib/active_support/deprecation/behaviors.rb +18 -16
  52. data/lib/active_support/deprecation/constant_accessor.rb +47 -26
  53. data/lib/active_support/deprecation/proxy_wrappers.rb +9 -12
  54. data/lib/active_support/deprecation/reporting.rb +13 -5
  55. data/lib/active_support/deprecation.rb +8 -5
  56. data/lib/active_support/descendants_tracker.rb +9 -87
  57. data/lib/active_support/duration/iso8601_parser.rb +2 -2
  58. data/lib/active_support/duration/iso8601_serializer.rb +1 -2
  59. data/lib/active_support/duration.rb +11 -6
  60. data/lib/active_support/error_reporter.rb +41 -3
  61. data/lib/active_support/evented_file_update_checker.rb +0 -1
  62. data/lib/active_support/execution_wrapper.rb +0 -1
  63. data/lib/active_support/file_update_checker.rb +1 -1
  64. data/lib/active_support/fork_tracker.rb +2 -38
  65. data/lib/active_support/gem_version.rb +1 -1
  66. data/lib/active_support/hash_with_indifferent_access.rb +6 -8
  67. data/lib/active_support/html_safe_translation.rb +19 -6
  68. data/lib/active_support/inflector/methods.rb +2 -2
  69. data/lib/active_support/log_subscriber.rb +9 -14
  70. data/lib/active_support/logger.rb +15 -2
  71. data/lib/active_support/logger_thread_safe_level.rb +0 -8
  72. data/lib/active_support/message_encryptors.rb +1 -0
  73. data/lib/active_support/message_pack/extensions.rb +15 -2
  74. data/lib/active_support/message_verifier.rb +12 -0
  75. data/lib/active_support/message_verifiers.rb +1 -0
  76. data/lib/active_support/messages/codec.rb +1 -1
  77. data/lib/active_support/messages/metadata.rb +1 -1
  78. data/lib/active_support/multibyte/chars.rb +2 -2
  79. data/lib/active_support/notifications/fanout.rb +29 -26
  80. data/lib/active_support/notifications/instrumenter.rb +43 -32
  81. data/lib/active_support/notifications.rb +28 -27
  82. data/lib/active_support/number_helper/number_converter.rb +5 -3
  83. data/lib/active_support/number_helper/number_to_human_size_converter.rb +2 -2
  84. data/lib/active_support/number_helper.rb +379 -318
  85. data/lib/active_support/option_merger.rb +2 -2
  86. data/lib/active_support/ordered_options.rb +55 -17
  87. data/lib/active_support/proxy_object.rb +8 -5
  88. data/lib/active_support/railtie.rb +4 -11
  89. data/lib/active_support/string_inquirer.rb +1 -1
  90. data/lib/active_support/syntax_error_proxy.rb +12 -1
  91. data/lib/active_support/tagged_logging.rb +4 -1
  92. data/lib/active_support/test_case.rb +3 -1
  93. data/lib/active_support/testing/assertions.rb +5 -5
  94. data/lib/active_support/testing/constant_stubbing.rb +30 -8
  95. data/lib/active_support/testing/deprecation.rb +5 -12
  96. data/lib/active_support/testing/isolation.rb +18 -8
  97. data/lib/active_support/testing/method_call_assertions.rb +2 -16
  98. data/lib/active_support/testing/setup_and_teardown.rb +2 -0
  99. data/lib/active_support/testing/strict_warnings.rb +6 -4
  100. data/lib/active_support/testing/tests_without_assertions.rb +19 -0
  101. data/lib/active_support/testing/time_helpers.rb +8 -4
  102. data/lib/active_support/time_with_zone.rb +7 -3
  103. data/lib/active_support/values/time_zone.rb +10 -1
  104. data/lib/active_support/xml_mini.rb +11 -2
  105. data/lib/active_support.rb +3 -2
  106. metadata +35 -15
  107. data/lib/active_support/deprecation/instance_delegator.rb +0 -65
  108. data/lib/active_support/ruby_features.rb +0 -7
@@ -12,7 +12,7 @@ module ActiveSupport
12
12
  # = \XmlMini
13
13
  #
14
14
  # To use the much faster libxml parser:
15
- # gem 'libxml-ruby'
15
+ # gem "libxml-ruby"
16
16
  # XmlMini.backend = 'LibXML'
17
17
  module XmlMini
18
18
  extend self
@@ -46,6 +46,7 @@ module ActiveSupport
46
46
  "Date" => "date",
47
47
  "DateTime" => "dateTime",
48
48
  "Time" => "dateTime",
49
+ "ActiveSupport::Duration" => "duration",
49
50
  "Array" => "array",
50
51
  "Hash" => "hash"
51
52
  }
@@ -56,6 +57,7 @@ module ActiveSupport
56
57
  "symbol" => Proc.new { |symbol| symbol.to_s },
57
58
  "date" => Proc.new { |date| date.to_fs(:db) },
58
59
  "dateTime" => Proc.new { |time| time.xmlschema },
60
+ "duration" => Proc.new { |duration| duration.iso8601 },
59
61
  "binary" => Proc.new { |binary| ::Base64.encode64(binary) },
60
62
  "yaml" => Proc.new { |yaml| yaml.to_yaml }
61
63
  } unless defined?(FORMATTING)
@@ -66,6 +68,7 @@ module ActiveSupport
66
68
  "symbol" => Proc.new { |symbol| symbol.to_s.to_sym },
67
69
  "date" => Proc.new { |date| ::Date.parse(date) },
68
70
  "datetime" => Proc.new { |time| Time.xmlschema(time).utc rescue ::DateTime.parse(time).utc },
71
+ "duration" => Proc.new { |duration| Duration.parse(duration) },
69
72
  "integer" => Proc.new { |integer| integer.to_i },
70
73
  "float" => Proc.new { |float| float.to_f },
71
74
  "decimal" => Proc.new do |number|
@@ -79,6 +82,7 @@ module ActiveSupport
79
82
  "string" => Proc.new { |string| string.to_s },
80
83
  "yaml" => Proc.new { |yaml| YAML.load(yaml) rescue yaml },
81
84
  "base64Binary" => Proc.new { |bin| ::Base64.decode64(bin) },
85
+ "hexBinary" => Proc.new { |bin| _parse_hex_binary(bin) },
82
86
  "binary" => Proc.new { |bin, entity| _parse_binary(bin, entity) },
83
87
  "file" => Proc.new { |file, entity| _parse_file(file, entity) }
84
88
  }
@@ -162,11 +166,12 @@ module ActiveSupport
162
166
  "#{left}#{middle.tr('_ ', '--')}#{right}"
163
167
  end
164
168
 
165
- # TODO: Add support for other encodings
166
169
  def _parse_binary(bin, entity)
167
170
  case entity["encoding"]
168
171
  when "base64"
169
172
  ::Base64.decode64(bin)
173
+ when "hex", "hexBinary"
174
+ _parse_hex_binary(bin)
170
175
  else
171
176
  bin
172
177
  end
@@ -180,6 +185,10 @@ module ActiveSupport
180
185
  f
181
186
  end
182
187
 
188
+ def _parse_hex_binary(bin)
189
+ [bin].pack("H*")
190
+ end
191
+
183
192
  def current_thread_backend
184
193
  IsolatedExecutionState[:xml_mini_backend]
185
194
  end
@@ -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: activesupport/README.rdoc
35
+ # :include: ../README.rdoc
36
36
  module ActiveSupport
37
37
  extend ActiveSupport::Autoload
38
38
 
@@ -63,6 +63,7 @@ module ActiveSupport
63
63
  autoload :Callbacks
64
64
  autoload :Configurable
65
65
  autoload :Deprecation
66
+ autoload :Delegation
66
67
  autoload :Digest
67
68
  autoload :ExecutionContext
68
69
  autoload :Gzip
@@ -116,7 +117,7 @@ module ActiveSupport
116
117
  def self.to_time_preserves_timezone=(value)
117
118
  unless value
118
119
  ActiveSupport.deprecator.warn(
119
- "Support for the pre-Ruby 2.4 behavior of to_time has been deprecated and will be removed in Rails 7.2."
120
+ "Support for the pre-Ruby 2.4 behavior of to_time has been deprecated and will be removed in Rails 8.0."
120
121
  )
121
122
  end
122
123
 
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.0
4
+ version: 7.2.0
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: 2023-10-05 00:00:00.000000000 Z
11
+ date: 2024-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -37,6 +37,9 @@ dependencies:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '2.0'
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: 2.0.5
40
43
  type: :runtime
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -44,6 +47,9 @@ dependencies:
44
47
  - - "~>"
45
48
  - !ruby/object:Gem::Version
46
49
  version: '2.0'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 2.0.5
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: concurrent-ruby
49
55
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +59,7 @@ dependencies:
53
59
  version: '1.0'
54
60
  - - ">="
55
61
  - !ruby/object:Gem::Version
56
- version: 1.0.2
62
+ version: 1.3.1
57
63
  type: :runtime
58
64
  prerelease: false
59
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -63,7 +69,7 @@ dependencies:
63
69
  version: '1.0'
64
70
  - - ">="
65
71
  - !ruby/object:Gem::Version
66
- version: 1.0.2
72
+ version: 1.3.1
67
73
  - !ruby/object:Gem::Dependency
68
74
  name: connection_pool
69
75
  requirement: !ruby/object:Gem::Requirement
@@ -121,7 +127,7 @@ dependencies:
121
127
  - !ruby/object:Gem::Version
122
128
  version: '0'
123
129
  - !ruby/object:Gem::Dependency
124
- name: mutex_m
130
+ name: bigdecimal
125
131
  requirement: !ruby/object:Gem::Requirement
126
132
  requirements:
127
133
  - - ">="
@@ -135,19 +141,33 @@ dependencies:
135
141
  - !ruby/object:Gem::Version
136
142
  version: '0'
137
143
  - !ruby/object:Gem::Dependency
138
- name: bigdecimal
144
+ name: logger
139
145
  requirement: !ruby/object:Gem::Requirement
140
146
  requirements:
141
147
  - - ">="
142
148
  - !ruby/object:Gem::Version
143
- version: '0'
149
+ version: 1.4.2
144
150
  type: :runtime
145
151
  prerelease: false
146
152
  version_requirements: !ruby/object:Gem::Requirement
147
153
  requirements:
148
154
  - - ">="
149
155
  - !ruby/object:Gem::Version
150
- version: '0'
156
+ version: 1.4.2
157
+ - !ruby/object:Gem::Dependency
158
+ name: securerandom
159
+ requirement: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: '0.3'
164
+ type: :runtime
165
+ prerelease: false
166
+ version_requirements: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: '0.3'
151
171
  description: A toolkit of support libraries and Ruby core extensions extracted from
152
172
  the Rails framework. Rich support for multibyte strings, internationalization, time
153
173
  zones, and testing.
@@ -308,6 +328,7 @@ files:
308
328
  - lib/active_support/current_attributes.rb
309
329
  - lib/active_support/current_attributes/test_helper.rb
310
330
  - lib/active_support/deep_mergeable.rb
331
+ - lib/active_support/delegation.rb
311
332
  - lib/active_support/dependencies.rb
312
333
  - lib/active_support/dependencies/autoload.rb
313
334
  - lib/active_support/dependencies/interlock.rb
@@ -317,7 +338,6 @@ files:
317
338
  - lib/active_support/deprecation/constant_accessor.rb
318
339
  - lib/active_support/deprecation/deprecators.rb
319
340
  - lib/active_support/deprecation/disallowed.rb
320
- - lib/active_support/deprecation/instance_delegator.rb
321
341
  - lib/active_support/deprecation/method_wrappers.rb
322
342
  - lib/active_support/deprecation/proxy_wrappers.rb
323
343
  - lib/active_support/deprecation/reporting.rb
@@ -403,7 +423,6 @@ files:
403
423
  - lib/active_support/railtie.rb
404
424
  - lib/active_support/reloader.rb
405
425
  - lib/active_support/rescuable.rb
406
- - lib/active_support/ruby_features.rb
407
426
  - lib/active_support/secure_compare_rotator.rb
408
427
  - lib/active_support/security_utils.rb
409
428
  - lib/active_support/string_inquirer.rb
@@ -429,6 +448,7 @@ files:
429
448
  - lib/active_support/testing/stream.rb
430
449
  - lib/active_support/testing/strict_warnings.rb
431
450
  - lib/active_support/testing/tagged_logging.rb
451
+ - lib/active_support/testing/tests_without_assertions.rb
432
452
  - lib/active_support/testing/time_helpers.rb
433
453
  - lib/active_support/time.rb
434
454
  - lib/active_support/time_with_zone.rb
@@ -446,10 +466,10 @@ licenses:
446
466
  - MIT
447
467
  metadata:
448
468
  bug_tracker_uri: https://github.com/rails/rails/issues
449
- changelog_uri: https://github.com/rails/rails/blob/v7.1.0/activesupport/CHANGELOG.md
450
- documentation_uri: https://api.rubyonrails.org/v7.1.0/
469
+ changelog_uri: https://github.com/rails/rails/blob/v7.2.0/activesupport/CHANGELOG.md
470
+ documentation_uri: https://api.rubyonrails.org/v7.2.0/
451
471
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
452
- source_code_uri: https://github.com/rails/rails/tree/v7.1.0/activesupport
472
+ source_code_uri: https://github.com/rails/rails/tree/v7.2.0/activesupport
453
473
  rubygems_mfa_required: 'true'
454
474
  post_install_message:
455
475
  rdoc_options:
@@ -461,14 +481,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
461
481
  requirements:
462
482
  - - ">="
463
483
  - !ruby/object:Gem::Version
464
- version: 2.7.0
484
+ version: 3.1.0
465
485
  required_rubygems_version: !ruby/object:Gem::Requirement
466
486
  requirements:
467
487
  - - ">="
468
488
  - !ruby/object:Gem::Version
469
489
  version: '0'
470
490
  requirements: []
471
- rubygems_version: 3.4.18
491
+ rubygems_version: 3.5.11
472
492
  signing_key:
473
493
  specification_version: 4
474
494
  summary: A toolkit of support libraries and Ruby core extensions extracted from the
@@ -1,65 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActiveSupport
4
- class Deprecation
5
- module InstanceDelegator # :nodoc:
6
- def self.included(base)
7
- base.extend(ClassMethods)
8
- base.singleton_class.prepend(OverrideDelegators)
9
- end
10
-
11
- module ClassMethods # :nodoc:
12
- MUTEX = Mutex.new
13
- private_constant :MUTEX
14
-
15
- def include(included_module)
16
- included_module.instance_methods.each { |m| method_added(m) }
17
- super
18
- end
19
-
20
- def method_added(method_name)
21
- use_instead =
22
- case method_name
23
- when :silence, :behavior=, :disallowed_behavior=, :disallowed_warnings=, :silenced=, :debug=
24
- target = "(defined?(Rails.application.deprecators) ? Rails.application.deprecators : ActiveSupport::Deprecation._instance)"
25
- "Rails.application.deprecators.#{method_name}"
26
- when :warn, :deprecate_methods, :gem_name, :gem_name=, :deprecation_horizon, :deprecation_horizon=
27
- "your own Deprecation object"
28
- else
29
- "Rails.application.deprecators[framework].#{method_name} where framework is for example :active_record"
30
- end
31
- args = /[^\]]=\z/.match?(method_name) ? "arg" : "..."
32
- target ||= "ActiveSupport::Deprecation._instance"
33
- singleton_class.module_eval <<~RUBY, __FILE__, __LINE__ + 1
34
- def #{method_name}(#{args})
35
- #{target}.#{method_name}(#{args})
36
- ensure
37
- ActiveSupport.deprecator.warn("Calling #{method_name} on ActiveSupport::Deprecation is deprecated and will be removed from Rails (use #{use_instead} instead)")
38
- end
39
- RUBY
40
- end
41
-
42
- def instance
43
- ActiveSupport.deprecator.warn("ActiveSupport::Deprecation.instance is deprecated (use your own Deprecation object)")
44
- _instance
45
- end
46
-
47
- def _instance
48
- @_instance ||= MUTEX.synchronize { @_instance ||= new }
49
- end
50
- end
51
-
52
- module OverrideDelegators # :nodoc:
53
- def warn(message = nil, callstack = nil)
54
- callstack ||= caller_locations(2)
55
- super
56
- end
57
-
58
- def deprecation_warning(deprecated_method_name, message = nil, caller_backtrace = nil)
59
- caller_backtrace ||= caller_locations(2)
60
- super
61
- end
62
- end
63
- end
64
- end
65
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActiveSupport
4
- module RubyFeatures # :nodoc:
5
- CLASS_SUBCLASSES = Class.method_defined?(:subclasses) # RUBY_VERSION >= "3.1"
6
- end
7
- end