activesupport 8.0.0.beta1 → 8.0.0.rc1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 492cd4c9d2ec59d97060d7949b3b68badc089d97ea467a30a0e6614d65e69c21
4
- data.tar.gz: 98af51f7ec102b694fbd17f636cdf942b965a9a845561f05b1569b07efc56747
3
+ metadata.gz: e51398b1109b9d7cbf736ee05a1bbae3b4239b163ffc32e6d72efff689a8681d
4
+ data.tar.gz: d9f79afec81e5609e14bd19b71f6be93f7fa5d55c31d2a063d67b300f8cbb118
5
5
  SHA512:
6
- metadata.gz: b720480df1c4117bf85c0f9066f7015dc750ca1279bba4c07a66a429effa06101adab40eda21f76c6d14ee1c57d46b6aff5cffd494e0e55d18600fe764c9d0e5
7
- data.tar.gz: 13d40213e5c9720bda46e71d696a6f011547ca95ade865061df922cc9abd5adfbf6a0daa651e0732314dfb67faf3c9ad3fde39bb3490f4e3fd7577fb24b8221b
6
+ metadata.gz: 0c39e8b68be9fa543af24098076abe8b52001c4955d12b5cb6ed943de52d28ffdf8a381abf8c7e7438af90590739f2bbab665a02245182d50174fbbad67e8949
7
+ data.tar.gz: 0bdac0fa92206843c4f58e7104463e53d1fe9775db8c6a732da02aff15663063c711f958cab388059be6f8b15a2c74a3f6912a42040b70b50d5d08323dd00a2b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,41 @@
1
+ ## Rails 8.0.0.rc1 (October 19, 2024) ##
2
+
3
+ * Remove deprecated support to passing an array of strings to `ActiveSupport::Deprecation#warn`.
4
+
5
+ *Rafael Mendonça França*
6
+
7
+ * Remove deprecated support to setting `attr_internal_naming_format` with a `@` prefix.
8
+
9
+ *Rafael Mendonça França*
10
+
11
+ * Remove deprecated `ActiveSupport::ProxyObject`.
12
+
13
+ *Rafael Mendonça França*
14
+
15
+ * Don't execute i18n watcher on boot. It shouldn't catch any file changes initially,
16
+ and unnecessarily slows down boot of applications with lots of translations.
17
+
18
+ *Gannon McGibbon*, *David Stosik*
19
+
20
+ * Fix `ActiveSupport::HashWithIndifferentAccess#stringify_keys` to stringify all keys not just symbols.
21
+
22
+ Previously:
23
+
24
+ ```ruby
25
+ { 1 => 2 }.with_indifferent_access.stringify_keys[1] # => 2
26
+ ```
27
+
28
+ After this change:
29
+
30
+ ```ruby
31
+ { 1 => 2 }.with_indifferent_access.stringify_keys["1"] # => 2
32
+ ```
33
+
34
+ This change can be seen as a bug fix, but since it behaved like this for a very long time, we're deciding
35
+ to not backport the fix and to make the change in a major release.
36
+
37
+ *Jean Boussier*
38
+
1
39
  ## Rails 8.0.0.beta1 (September 26, 2024) ##
2
40
 
3
41
  * Include options when instrumenting `ActiveSupport::Cache::Store#delete` and `ActiveSupport::Cache::Store#delete_multi`.
@@ -24,14 +24,13 @@ class Module
24
24
 
25
25
  def attr_internal_naming_format=(format)
26
26
  if format.start_with?("@")
27
- ActiveSupport.deprecator.warn <<~MESSAGE
28
- Setting `attr_internal_naming_format` with a `@` prefix is deprecated and will be removed in Rails 8.0.
27
+ raise ArgumentError, <<~MESSAGE.squish
28
+ Setting `attr_internal_naming_format` with a `@` prefix is not supported.
29
29
 
30
30
  You can simply replace #{format.inspect} by #{format.delete_prefix("@").inspect}.
31
31
  MESSAGE
32
-
33
- format = format.delete_prefix("@")
34
32
  end
33
+
35
34
  @attr_internal_naming_format = format
36
35
  end
37
36
  end
@@ -1,12 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Thread::Backtrace::Location # :nodoc:
4
- if defined?(ErrorHighlight) && Gem::Version.new(ErrorHighlight::VERSION) >= Gem::Version.new("0.4.0")
5
- def spot(ex)
6
- ErrorHighlight.spot(ex, backtrace_location: self)
7
- end
8
- else
9
- def spot(ex)
10
- end
4
+ def spot(ex)
5
+ ErrorHighlight.spot(ex, backtrace_location: self)
11
6
  end
12
7
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "set"
4
-
5
3
  module ActiveSupport
6
4
  # Error generated by +delegate+ when a method is called on +nil+ and +allow_nil+
7
5
  # option is not used.
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "set"
4
3
  require "active_support/dependencies/interlock"
5
4
 
6
5
  module ActiveSupport # :nodoc:
@@ -139,7 +139,6 @@ module ActiveSupport
139
139
 
140
140
  def extract_callstack(callstack)
141
141
  return [] if callstack.empty?
142
- return _extract_callstack(callstack) if callstack.first.is_a? String
143
142
 
144
143
  offending_line = callstack.find { |frame|
145
144
  # Code generated with `eval` doesn't have an `absolute_path`, e.g. templates.
@@ -150,24 +149,6 @@ module ActiveSupport
150
149
  [offending_line.path, offending_line.lineno, offending_line.label]
151
150
  end
152
151
 
153
- def _extract_callstack(callstack)
154
- ActiveSupport.deprecator.warn(<<~MESSAGE)
155
- Passing the result of `caller` to ActiveSupport::Deprecation#warn is deprecated and will be removed in Rails 8.0.
156
-
157
- Please pass the result of `caller_locations` instead.
158
- MESSAGE
159
-
160
- offending_line = callstack.find { |line| !ignored_callstack?(line) } || callstack.first
161
-
162
- if offending_line
163
- if md = offending_line.match(/^(.+?):(\d+)(?::in `(.*?)')?/)
164
- md.captures
165
- else
166
- offending_line
167
- end
168
- end
169
- end
170
-
171
152
  RAILS_GEM_ROOT = File.expand_path("../../../..", __dir__) + "/" # :nodoc:
172
153
  LIB_DIR = RbConfig::CONFIG["libdir"] # :nodoc:
173
154
 
@@ -491,17 +491,21 @@ module ActiveSupport
491
491
  if @parts.empty?
492
492
  time.since(sign * value)
493
493
  else
494
- @parts.inject(time) do |t, (type, number)|
495
- if type == :seconds
496
- t.since(sign * number)
497
- elsif type == :minutes
498
- t.since(sign * number * 60)
499
- elsif type == :hours
500
- t.since(sign * number * 3600)
501
- else
502
- t.advance(type => sign * number)
503
- end
494
+ @parts.each do |type, number|
495
+ t = time
496
+ time =
497
+ if type == :seconds
498
+ t.since(sign * number)
499
+ elsif type == :minutes
500
+ t.since(sign * number * 60)
501
+ elsif type == :hours
502
+ t.since(sign * number * 3600)
503
+ else
504
+ t.advance(type => sign * number)
505
+ end
504
506
  end
507
+
508
+ time
505
509
  end
506
510
  end
507
511
 
@@ -3,7 +3,6 @@
3
3
  gem "listen", "~> 3.5"
4
4
  require "listen"
5
5
 
6
- require "set"
7
6
  require "pathname"
8
7
  require "concurrent/atomic/atomic_boolean"
9
8
 
@@ -10,7 +10,7 @@ module ActiveSupport
10
10
  MAJOR = 8
11
11
  MINOR = 0
12
12
  TINY = 0
13
- PRE = "beta1"
13
+ PRE = "rc1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -313,10 +313,6 @@ module ActiveSupport
313
313
  end
314
314
  alias_method :without, :except
315
315
 
316
- def stringify_keys!; self end
317
- def deep_stringify_keys!; self end
318
- def stringify_keys; dup end
319
- def deep_stringify_keys; dup end
320
316
  undef :symbolize_keys!
321
317
  undef :deep_symbolize_keys!
322
318
  def symbolize_keys; to_hash.symbolize_keys! end
@@ -66,9 +66,9 @@ module I18n
66
66
 
67
67
  if app.config.reloading_enabled?
68
68
  directories = watched_dirs_with_extensions(reloadable_paths)
69
- root_load_paths = I18n.load_path.select { |path| path.start_with?(Rails.root.to_s) }
69
+ root_load_paths = I18n.load_path.select { |path| path.to_s.start_with?(Rails.root.to_s) }
70
70
  reloader = app.config.file_watcher.new(root_load_paths, directories) do
71
- I18n.load_path.delete_if { |p| p.start_with?(Rails.root.to_s) && !File.exist?(p) }
71
+ I18n.load_path.delete_if { |path| path.to_s.start_with?(Rails.root.to_s) && !File.exist?(path) }
72
72
  I18n.load_path |= reloadable_paths.flat_map(&:existent)
73
73
  end
74
74
 
@@ -76,7 +76,6 @@ module I18n
76
76
  app.reloader.to_run do
77
77
  reloader.execute_if_updated { require_unload_lock! }
78
78
  end
79
- reloader.execute
80
79
  end
81
80
 
82
81
  @i18n_inited = true
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
-
4
3
  module ActiveSupport
5
4
  module IsolatedExecutionState # :nodoc:
6
5
  @isolation_level = nil
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "concurrent/map"
4
- require "set"
5
4
  require "active_support/core_ext/object/try"
6
5
 
7
6
  module ActiveSupport
@@ -299,17 +299,24 @@ module ActiveSupport
299
299
  end
300
300
 
301
301
  def _callable_to_source_string(callable)
302
- if defined?(RubyVM::AbstractSyntaxTree) && callable.is_a?(Proc)
303
- ast = begin
304
- RubyVM::AbstractSyntaxTree.of(callable, keep_script_lines: true)
305
- rescue SystemCallError
306
- # Failed to get the source somehow
307
- return callable
308
- end
309
- return callable unless ast
302
+ if defined?(RubyVM::InstructionSequence) && callable.is_a?(Proc)
303
+ iseq = RubyVM::InstructionSequence.of(callable)
304
+ source =
305
+ if iseq.script_lines
306
+ iseq.script_lines.join("\n")
307
+ elsif File.readable?(iseq.absolute_path)
308
+ File.read(iseq.absolute_path)
309
+ end
310
+
311
+ return callable unless source
312
+
313
+ location = iseq.to_a[4][:code_location]
314
+ return callable unless location
310
315
 
311
- source = ast.source
312
- source.strip!
316
+ lines = source.lines[(location[0] - 1)..(location[2] - 1)]
317
+ lines[-1] = lines[-1].byteslice(...location[3])
318
+ lines[0] = lines[0].byteslice(location[1]...)
319
+ source = lines.join.strip
313
320
 
314
321
  # We ignore procs defined with do/end as they are likely multi-line anyway.
315
322
  if source.start_with?("{")
@@ -16,7 +16,7 @@ module ActiveSupport
16
16
  /Failed to validate the schema cache because/,
17
17
 
18
18
  # TODO: We need to decide what to do with this.
19
- /Status code :unprocessable_entity is deprecated/
19
+ /Status code :unprocessable_entity is deprecated/,
20
20
  )
21
21
 
22
22
  SUPPRESSED_WARNINGS = Regexp.union(
@@ -12,7 +12,7 @@ module ActiveSupport
12
12
  # * Limit the set of zones provided by TZInfo to a meaningful subset of 134
13
13
  # zones.
14
14
  # * Retrieve and display zones with a friendlier name
15
- # (e.g., "Eastern Time (US & Canada)" instead of "America/New_York").
15
+ # (e.g., "Eastern \Time (US & Canada)" instead of "America/New_York").
16
16
  # * Lazily load +TZInfo::Timezone+ instances only when they're needed.
17
17
  # * Create ActiveSupport::TimeWithZone instances via TimeZone's +local+,
18
18
  # +parse+, +at+, and +now+ methods.
@@ -355,7 +355,7 @@ module ActiveSupport
355
355
  "(GMT#{formatted_offset}) #{name}"
356
356
  end
357
357
 
358
- # Method for creating new ActiveSupport::TimeWithZone instance in time zone
358
+ # \Method for creating new ActiveSupport::TimeWithZone instance in time zone
359
359
  # of +self+ from given values.
360
360
  #
361
361
  # Time.zone = 'Hawaii' # => "Hawaii"
@@ -365,7 +365,7 @@ module ActiveSupport
365
365
  ActiveSupport::TimeWithZone.new(nil, self, time)
366
366
  end
367
367
 
368
- # Method for creating new ActiveSupport::TimeWithZone instance in time zone
368
+ # \Method for creating new ActiveSupport::TimeWithZone instance in time zone
369
369
  # of +self+ from number of seconds since the Unix epoch.
370
370
  #
371
371
  # Time.zone = 'Hawaii' # => "Hawaii"
@@ -380,7 +380,7 @@ module ActiveSupport
380
380
  Time.at(*args).utc.in_time_zone(self)
381
381
  end
382
382
 
383
- # Method for creating new ActiveSupport::TimeWithZone instance in time zone
383
+ # \Method for creating new ActiveSupport::TimeWithZone instance in time zone
384
384
  # of +self+ from an ISO 8601 string.
385
385
  #
386
386
  # Time.zone = 'Hawaii' # => "Hawaii"
@@ -432,7 +432,7 @@ module ActiveSupport
432
432
  raise ArgumentError, "invalid date"
433
433
  end
434
434
 
435
- # Method for creating new ActiveSupport::TimeWithZone instance in time zone
435
+ # \Method for creating new ActiveSupport::TimeWithZone instance in time zone
436
436
  # of +self+ from parsed string.
437
437
  #
438
438
  # Time.zone = 'Hawaii' # => "Hawaii"
@@ -454,7 +454,7 @@ module ActiveSupport
454
454
  parts_to_time(Date._parse(str, false), now)
455
455
  end
456
456
 
457
- # Method for creating new ActiveSupport::TimeWithZone instance in time zone
457
+ # \Method for creating new ActiveSupport::TimeWithZone instance in time zone
458
458
  # of +self+ from an RFC 3339 string.
459
459
  #
460
460
  # Time.zone = 'Hawaii' # => "Hawaii"
@@ -57,7 +57,6 @@ module ActiveSupport
57
57
 
58
58
  eager_autoload do
59
59
  autoload :BacktraceCleaner
60
- autoload :ProxyObject
61
60
  autoload :Benchmark
62
61
  autoload :Benchmarkable
63
62
  autoload :Cache
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: 8.0.0.beta1
4
+ version: 8.0.0.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: 2024-09-26 00:00:00.000000000 Z
11
+ date: 2024-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -448,7 +448,6 @@ files:
448
448
  - lib/active_support/ordered_hash.rb
449
449
  - lib/active_support/ordered_options.rb
450
450
  - lib/active_support/parameter_filter.rb
451
- - lib/active_support/proxy_object.rb
452
451
  - lib/active_support/rails.rb
453
452
  - lib/active_support/railtie.rb
454
453
  - lib/active_support/reloader.rb
@@ -496,10 +495,10 @@ licenses:
496
495
  - MIT
497
496
  metadata:
498
497
  bug_tracker_uri: https://github.com/rails/rails/issues
499
- changelog_uri: https://github.com/rails/rails/blob/v8.0.0.beta1/activesupport/CHANGELOG.md
500
- documentation_uri: https://api.rubyonrails.org/v8.0.0.beta1/
498
+ changelog_uri: https://github.com/rails/rails/blob/v8.0.0.rc1/activesupport/CHANGELOG.md
499
+ documentation_uri: https://api.rubyonrails.org/v8.0.0.rc1/
501
500
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
502
- source_code_uri: https://github.com/rails/rails/tree/v8.0.0.beta1/activesupport
501
+ source_code_uri: https://github.com/rails/rails/tree/v8.0.0.rc1/activesupport
503
502
  rubygems_mfa_required: 'true'
504
503
  post_install_message:
505
504
  rdoc_options:
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActiveSupport
4
- class ProxyObject < ::BasicObject # :nodoc:
5
- undef_method :==
6
- undef_method :equal?
7
-
8
- # Let ActiveSupport::ProxyObject at least raise exceptions.
9
- def raise(*args)
10
- ::Object.send(:raise, *args)
11
- end
12
-
13
- def self.inherited(_subclass)
14
- ::ActiveSupport.deprecator.warn(<<~MSG)
15
- ActiveSupport::ProxyObject is deprecated and will be removed in Rails 8.0.
16
- Use Ruby's built-in BasicObject instead.
17
- MSG
18
- end
19
- end
20
- end