activesupport 7.1.2 → 7.1.5

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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +134 -0
  3. data/lib/active_support/backtrace_cleaner.rb +5 -0
  4. data/lib/active_support/broadcast_logger.rb +15 -14
  5. data/lib/active_support/cache/mem_cache_store.rb +6 -6
  6. data/lib/active_support/cache/memory_store.rb +4 -4
  7. data/lib/active_support/cache/redis_cache_store.rb +16 -12
  8. data/lib/active_support/cache/strategy/local_cache.rb +9 -6
  9. data/lib/active_support/cache.rb +17 -6
  10. data/lib/active_support/code_generator.rb +15 -10
  11. data/lib/active_support/core_ext/module/delegation.rb +41 -26
  12. data/lib/active_support/core_ext/object/duplicable.rb +24 -15
  13. data/lib/active_support/core_ext/object/json.rb +5 -3
  14. data/lib/active_support/core_ext/object/with_options.rb +1 -1
  15. data/lib/active_support/core_ext/string/indent.rb +1 -1
  16. data/lib/active_support/deprecation/behaviors.rb +18 -16
  17. data/lib/active_support/deprecation/reporting.rb +8 -5
  18. data/lib/active_support/gem_version.rb +1 -1
  19. data/lib/active_support/html_safe_translation.rb +16 -6
  20. data/lib/active_support/log_subscriber.rb +1 -0
  21. data/lib/active_support/messages/codec.rb +1 -1
  22. data/lib/active_support/notifications/instrumenter.rb +11 -3
  23. data/lib/active_support/number_helper.rb +379 -318
  24. data/lib/active_support/railtie.rb +3 -3
  25. data/lib/active_support/syntax_error_proxy.rb +12 -1
  26. data/lib/active_support/tagged_logging.rb +4 -0
  27. data/lib/active_support/testing/assertions.rb +1 -1
  28. data/lib/active_support/testing/setup_and_teardown.rb +2 -0
  29. data/lib/active_support/testing/time_helpers.rb +4 -0
  30. data/lib/active_support/values/time_zone.rb +9 -0
  31. data/lib/active_support.rb +1 -1
  32. metadata +51 -9
@@ -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 == "disable_to_s_conversion"
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 == "remove_deprecated_time_with_zone_name"
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 == "use_rfc4122_namespaced_uuids"
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}="
@@ -32,6 +32,8 @@ module ActiveSupport
32
32
  end
33
33
 
34
34
  def backtrace_locations
35
+ return nil if super.nil?
36
+
35
37
  parse_message_for_trace.map { |trace|
36
38
  file, line = trace.match(/^(.+?):(\d+).*$/, &:captures) || trace
37
39
  BacktraceLocation.new(file, line.to_i, trace)
@@ -43,7 +45,16 @@ module ActiveSupport
43
45
 
44
46
  private
45
47
  def parse_message_for_trace
46
- __getobj__.to_s.split("\n")
48
+ if __getobj__.to_s.start_with?("(eval")
49
+ # If the exception is coming from a call to eval, we need to keep
50
+ # the path of the file in which eval was called to ensure we can
51
+ # return the right source fragment to show the location of the
52
+ # error
53
+ location = __getobj__.backtrace_locations[0]
54
+ ["#{location.path}:#{location.lineno}: #{__getobj__}"]
55
+ else
56
+ __getobj__.to_s.split("\n")
57
+ end
47
58
  end
48
59
  end
49
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
@@ -223,7 +223,7 @@ module ActiveSupport
223
223
  # post :create, params: { status: { ok: true } }
224
224
  # end
225
225
  #
226
- # Provide the optional keyword argument :from to specify the expected
226
+ # Provide the optional keyword argument +:from+ to specify the expected
227
227
  # initial value.
228
228
  #
229
229
  # assert_no_changes -> { Status.all_good? }, from: true do
@@ -46,6 +46,8 @@ module ActiveSupport
46
46
  run_callbacks :teardown
47
47
  rescue => e
48
48
  self.failures << Minitest::UnexpectedError.new(e)
49
+ rescue Minitest::Assertion => e
50
+ self.failures << e
49
51
  end
50
52
 
51
53
  super
@@ -169,6 +169,10 @@ module ActiveSupport
169
169
  now = date_or_time.to_time.change(usec: 0)
170
170
  end
171
171
 
172
+ # +now+ must be in local system timezone, because +Time.at(now)+
173
+ # and +now.to_date+ (see stubs below) will use +now+'s timezone too!
174
+ now = now.getlocal
175
+
172
176
  stubs = simple_stubs
173
177
  stubbed_time = Time.now if stubs.stubbing(Time, :now)
174
178
  stubs.stub_object(Time, :now) { at(now) }
@@ -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
@@ -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
 
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.2
4
+ version: 7.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-10 00:00:00.000000000 Z
11
+ date: 2024-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -148,6 +148,48 @@ dependencies:
148
148
  - - ">="
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
+ - !ruby/object:Gem::Dependency
152
+ name: logger
153
+ requirement: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ version: 1.4.2
158
+ type: :runtime
159
+ prerelease: false
160
+ version_requirements: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - ">="
163
+ - !ruby/object:Gem::Version
164
+ version: 1.4.2
165
+ - !ruby/object:Gem::Dependency
166
+ name: securerandom
167
+ requirement: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: '0.3'
172
+ type: :runtime
173
+ prerelease: false
174
+ version_requirements: !ruby/object:Gem::Requirement
175
+ requirements:
176
+ - - ">="
177
+ - !ruby/object:Gem::Version
178
+ version: '0.3'
179
+ - !ruby/object:Gem::Dependency
180
+ name: benchmark
181
+ requirement: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - ">="
184
+ - !ruby/object:Gem::Version
185
+ version: '0.3'
186
+ type: :runtime
187
+ prerelease: false
188
+ version_requirements: !ruby/object:Gem::Requirement
189
+ requirements:
190
+ - - ">="
191
+ - !ruby/object:Gem::Version
192
+ version: '0.3'
151
193
  description: A toolkit of support libraries and Ruby core extensions extracted from
152
194
  the Rails framework. Rich support for multibyte strings, internationalization, time
153
195
  zones, and testing.
@@ -446,12 +488,12 @@ licenses:
446
488
  - MIT
447
489
  metadata:
448
490
  bug_tracker_uri: https://github.com/rails/rails/issues
449
- changelog_uri: https://github.com/rails/rails/blob/v7.1.2/activesupport/CHANGELOG.md
450
- documentation_uri: https://api.rubyonrails.org/v7.1.2/
491
+ changelog_uri: https://github.com/rails/rails/blob/v7.1.5/activesupport/CHANGELOG.md
492
+ documentation_uri: https://api.rubyonrails.org/v7.1.5/
451
493
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
452
- source_code_uri: https://github.com/rails/rails/tree/v7.1.2/activesupport
494
+ source_code_uri: https://github.com/rails/rails/tree/v7.1.5/activesupport
453
495
  rubygems_mfa_required: 'true'
454
- post_install_message:
496
+ post_install_message:
455
497
  rdoc_options:
456
498
  - "--encoding"
457
499
  - UTF-8
@@ -468,8 +510,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
468
510
  - !ruby/object:Gem::Version
469
511
  version: '0'
470
512
  requirements: []
471
- rubygems_version: 3.4.18
472
- signing_key:
513
+ rubygems_version: 3.5.16
514
+ signing_key:
473
515
  specification_version: 4
474
516
  summary: A toolkit of support libraries and Ruby core extensions extracted from the
475
517
  Rails framework.