activesupport 6.1.6.1 → 7.0.3.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activesupport might be problematic. Click here for more details.

Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +231 -515
  3. data/lib/active_support/actionable_error.rb +1 -1
  4. data/lib/active_support/array_inquirer.rb +0 -2
  5. data/lib/active_support/backtrace_cleaner.rb +2 -2
  6. data/lib/active_support/benchmarkable.rb +2 -2
  7. data/lib/active_support/cache/file_store.rb +15 -9
  8. data/lib/active_support/cache/mem_cache_store.rb +132 -37
  9. data/lib/active_support/cache/memory_store.rb +24 -16
  10. data/lib/active_support/cache/null_store.rb +10 -2
  11. data/lib/active_support/cache/redis_cache_store.rb +47 -72
  12. data/lib/active_support/cache/strategy/local_cache.rb +38 -61
  13. data/lib/active_support/cache.rb +193 -46
  14. data/lib/active_support/callbacks.rb +184 -85
  15. data/lib/active_support/code_generator.rb +65 -0
  16. data/lib/active_support/concern.rb +5 -5
  17. data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +2 -4
  18. data/lib/active_support/concurrency/share_lock.rb +2 -2
  19. data/lib/active_support/configurable.rb +8 -5
  20. data/lib/active_support/configuration_file.rb +1 -1
  21. data/lib/active_support/core_ext/array/access.rb +1 -5
  22. data/lib/active_support/core_ext/array/conversions.rb +13 -12
  23. data/lib/active_support/core_ext/array/deprecated_conversions.rb +25 -0
  24. data/lib/active_support/core_ext/array/grouping.rb +6 -6
  25. data/lib/active_support/core_ext/array/inquiry.rb +2 -2
  26. data/lib/active_support/core_ext/array.rb +1 -0
  27. data/lib/active_support/core_ext/big_decimal/conversions.rb +1 -1
  28. data/lib/active_support/core_ext/class/subclasses.rb +25 -17
  29. data/lib/active_support/core_ext/date/blank.rb +1 -1
  30. data/lib/active_support/core_ext/date/calculations.rb +9 -9
  31. data/lib/active_support/core_ext/date/conversions.rb +14 -14
  32. data/lib/active_support/core_ext/date/deprecated_conversions.rb +26 -0
  33. data/lib/active_support/core_ext/date.rb +1 -0
  34. data/lib/active_support/core_ext/date_and_time/calculations.rb +4 -4
  35. data/lib/active_support/core_ext/date_and_time/compatibility.rb +1 -1
  36. data/lib/active_support/core_ext/date_time/blank.rb +1 -1
  37. data/lib/active_support/core_ext/date_time/conversions.rb +13 -13
  38. data/lib/active_support/core_ext/date_time/deprecated_conversions.rb +22 -0
  39. data/lib/active_support/core_ext/date_time.rb +1 -0
  40. data/lib/active_support/core_ext/digest/uuid.rb +39 -14
  41. data/lib/active_support/core_ext/enumerable.rb +101 -32
  42. data/lib/active_support/core_ext/file/atomic.rb +3 -1
  43. data/lib/active_support/core_ext/hash/conversions.rb +0 -1
  44. data/lib/active_support/core_ext/hash/indifferent_access.rb +3 -3
  45. data/lib/active_support/core_ext/hash/keys.rb +1 -1
  46. data/lib/active_support/core_ext/kernel/reporting.rb +4 -4
  47. data/lib/active_support/core_ext/kernel/singleton_class.rb +1 -1
  48. data/lib/active_support/core_ext/module/attribute_accessors.rb +2 -0
  49. data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +19 -10
  50. data/lib/active_support/core_ext/module/delegation.rb +2 -8
  51. data/lib/active_support/core_ext/name_error.rb +2 -8
  52. data/lib/active_support/core_ext/numeric/conversions.rb +80 -77
  53. data/lib/active_support/core_ext/numeric/deprecated_conversions.rb +60 -0
  54. data/lib/active_support/core_ext/numeric.rb +1 -0
  55. data/lib/active_support/core_ext/object/acts_like.rb +29 -5
  56. data/lib/active_support/core_ext/object/blank.rb +2 -2
  57. data/lib/active_support/core_ext/object/deep_dup.rb +1 -1
  58. data/lib/active_support/core_ext/object/duplicable.rb +11 -0
  59. data/lib/active_support/core_ext/object/json.rb +30 -25
  60. data/lib/active_support/core_ext/object/to_query.rb +2 -2
  61. data/lib/active_support/core_ext/object/try.rb +20 -20
  62. data/lib/active_support/core_ext/object/with_options.rb +20 -1
  63. data/lib/active_support/core_ext/pathname/existence.rb +21 -0
  64. data/lib/active_support/core_ext/pathname.rb +3 -0
  65. data/lib/active_support/core_ext/range/compare_range.rb +0 -25
  66. data/lib/active_support/core_ext/range/conversions.rb +8 -8
  67. data/lib/active_support/core_ext/range/deprecated_conversions.rb +26 -0
  68. data/lib/active_support/core_ext/range/each.rb +1 -1
  69. data/lib/active_support/core_ext/range/include_time_with_zone.rb +4 -25
  70. data/lib/active_support/core_ext/range/overlaps.rb +1 -1
  71. data/lib/active_support/core_ext/range.rb +1 -1
  72. data/lib/active_support/core_ext/securerandom.rb +1 -1
  73. data/lib/active_support/core_ext/string/conversions.rb +2 -2
  74. data/lib/active_support/core_ext/string/filters.rb +1 -1
  75. data/lib/active_support/core_ext/string/inflections.rb +1 -1
  76. data/lib/active_support/core_ext/string/inquiry.rb +1 -1
  77. data/lib/active_support/core_ext/string/output_safety.rb +62 -38
  78. data/lib/active_support/core_ext/symbol/starts_ends_with.rb +0 -8
  79. data/lib/active_support/core_ext/time/calculations.rb +7 -8
  80. data/lib/active_support/core_ext/time/conversions.rb +13 -12
  81. data/lib/active_support/core_ext/time/deprecated_conversions.rb +22 -0
  82. data/lib/active_support/core_ext/time/zones.rb +7 -22
  83. data/lib/active_support/core_ext/time.rb +1 -0
  84. data/lib/active_support/core_ext/uri.rb +3 -27
  85. data/lib/active_support/core_ext.rb +1 -0
  86. data/lib/active_support/current_attributes.rb +31 -14
  87. data/lib/active_support/dependencies/interlock.rb +10 -18
  88. data/lib/active_support/dependencies/require_dependency.rb +28 -0
  89. data/lib/active_support/dependencies.rb +58 -788
  90. data/lib/active_support/deprecation/behaviors.rb +5 -2
  91. data/lib/active_support/deprecation/method_wrappers.rb +3 -3
  92. data/lib/active_support/deprecation/proxy_wrappers.rb +2 -2
  93. data/lib/active_support/deprecation.rb +2 -2
  94. data/lib/active_support/descendants_tracker.rb +174 -68
  95. data/lib/active_support/digest.rb +4 -4
  96. data/lib/active_support/duration/iso8601_parser.rb +3 -3
  97. data/lib/active_support/duration/iso8601_serializer.rb +9 -1
  98. data/lib/active_support/duration.rb +77 -48
  99. data/lib/active_support/encrypted_configuration.rb +13 -2
  100. data/lib/active_support/encrypted_file.rb +1 -1
  101. data/lib/active_support/environment_inquirer.rb +1 -1
  102. data/lib/active_support/error_reporter.rb +117 -0
  103. data/lib/active_support/evented_file_update_checker.rb +3 -5
  104. data/lib/active_support/execution_context/test_helper.rb +13 -0
  105. data/lib/active_support/execution_context.rb +53 -0
  106. data/lib/active_support/execution_wrapper.rb +30 -11
  107. data/lib/active_support/executor/test_helper.rb +7 -0
  108. data/lib/active_support/fork_tracker.rb +19 -12
  109. data/lib/active_support/gem_version.rb +4 -4
  110. data/lib/active_support/hash_with_indifferent_access.rb +3 -1
  111. data/lib/active_support/html_safe_translation.rb +43 -0
  112. data/lib/active_support/i18n.rb +1 -0
  113. data/lib/active_support/i18n_railtie.rb +1 -1
  114. data/lib/active_support/inflector/inflections.rb +23 -7
  115. data/lib/active_support/inflector/methods.rb +24 -48
  116. data/lib/active_support/inflector/transliterate.rb +1 -1
  117. data/lib/active_support/isolated_execution_state.rb +72 -0
  118. data/lib/active_support/json/encoding.rb +3 -3
  119. data/lib/active_support/key_generator.rb +22 -5
  120. data/lib/active_support/lazy_load_hooks.rb +14 -3
  121. data/lib/active_support/locale/en.yml +1 -1
  122. data/lib/active_support/log_subscriber/test_helper.rb +2 -2
  123. data/lib/active_support/log_subscriber.rb +15 -5
  124. data/lib/active_support/logger.rb +4 -5
  125. data/lib/active_support/logger_thread_safe_level.rb +4 -13
  126. data/lib/active_support/message_encryptor.rb +12 -6
  127. data/lib/active_support/message_verifier.rb +46 -14
  128. data/lib/active_support/messages/metadata.rb +2 -2
  129. data/lib/active_support/multibyte/chars.rb +10 -11
  130. data/lib/active_support/multibyte/unicode.rb +0 -12
  131. data/lib/active_support/multibyte.rb +1 -1
  132. data/lib/active_support/notifications/fanout.rb +91 -65
  133. data/lib/active_support/notifications/instrumenter.rb +32 -15
  134. data/lib/active_support/notifications.rb +17 -23
  135. data/lib/active_support/number_helper/number_converter.rb +1 -3
  136. data/lib/active_support/number_helper/number_to_currency_converter.rb +11 -6
  137. data/lib/active_support/number_helper/number_to_delimited_converter.rb +1 -1
  138. data/lib/active_support/number_helper/number_to_human_size_converter.rb +1 -1
  139. data/lib/active_support/number_helper/number_to_phone_converter.rb +1 -1
  140. data/lib/active_support/number_helper/rounding_helper.rb +1 -5
  141. data/lib/active_support/number_helper.rb +0 -2
  142. data/lib/active_support/option_merger.rb +8 -16
  143. data/lib/active_support/ordered_hash.rb +1 -1
  144. data/lib/active_support/ordered_options.rb +1 -1
  145. data/lib/active_support/parameter_filter.rb +5 -0
  146. data/lib/active_support/per_thread_registry.rb +5 -1
  147. data/lib/active_support/railtie.rb +69 -19
  148. data/lib/active_support/rescuable.rb +4 -4
  149. data/lib/active_support/ruby_features.rb +7 -0
  150. data/lib/active_support/secure_compare_rotator.rb +2 -2
  151. data/lib/active_support/string_inquirer.rb +0 -2
  152. data/lib/active_support/subscriber.rb +7 -18
  153. data/lib/active_support/tagged_logging.rb +16 -1
  154. data/lib/active_support/test_case.rb +9 -21
  155. data/lib/active_support/testing/assertions.rb +35 -5
  156. data/lib/active_support/testing/deprecation.rb +52 -1
  157. data/lib/active_support/testing/isolation.rb +2 -2
  158. data/lib/active_support/testing/method_call_assertions.rb +5 -5
  159. data/lib/active_support/testing/parallelization/server.rb +4 -0
  160. data/lib/active_support/testing/parallelization/worker.rb +3 -0
  161. data/lib/active_support/testing/parallelization.rb +4 -0
  162. data/lib/active_support/testing/parallelize_executor.rb +76 -0
  163. data/lib/active_support/testing/stream.rb +3 -5
  164. data/lib/active_support/testing/tagged_logging.rb +1 -1
  165. data/lib/active_support/testing/time_helpers.rb +13 -2
  166. data/lib/active_support/time_with_zone.rb +58 -17
  167. data/lib/active_support/values/time_zone.rb +33 -14
  168. data/lib/active_support/version.rb +1 -1
  169. data/lib/active_support/xml_mini/jdom.rb +1 -1
  170. data/lib/active_support/xml_mini/libxml.rb +5 -5
  171. data/lib/active_support/xml_mini/libxmlsax.rb +1 -1
  172. data/lib/active_support/xml_mini/nokogiri.rb +4 -4
  173. data/lib/active_support/xml_mini/nokogirisax.rb +1 -1
  174. data/lib/active_support/xml_mini/rexml.rb +1 -1
  175. data/lib/active_support/xml_mini.rb +5 -4
  176. data/lib/active_support.rb +16 -0
  177. metadata +23 -21
  178. data/lib/active_support/core_ext/marshal.rb +0 -26
  179. data/lib/active_support/dependencies/zeitwerk_integration.rb +0 -120
@@ -4,16 +4,16 @@ require "tzinfo"
4
4
  require "concurrent/map"
5
5
 
6
6
  module ActiveSupport
7
- # The TimeZone class serves as a wrapper around TZInfo::Timezone instances.
7
+ # The TimeZone class serves as a wrapper around <tt>TZInfo::Timezone</tt> instances.
8
8
  # It allows us to do the following:
9
9
  #
10
10
  # * Limit the set of zones provided by TZInfo to a meaningful subset of 134
11
11
  # zones.
12
12
  # * Retrieve and display zones with a friendlier name
13
13
  # (e.g., "Eastern Time (US & Canada)" instead of "America/New_York").
14
- # * Lazily load TZInfo::Timezone instances only when they're needed.
14
+ # * Lazily load <tt>TZInfo::Timezone</tt> instances only when they're needed.
15
15
  # * Create ActiveSupport::TimeWithZone instances via TimeZone's +local+,
16
- # +parse+, +at+ and +now+ methods.
16
+ # +parse+, +at+, and +now+ methods.
17
17
  #
18
18
  # If you set <tt>config.time_zone</tt> in the Rails Application, you can
19
19
  # access this TimeZone object via <tt>Time.zone</tt>:
@@ -229,12 +229,16 @@ module ActiveSupport
229
229
  # Returns +nil+ if no such time zone is known to the system.
230
230
  def [](arg)
231
231
  case arg
232
+ when self
233
+ arg
232
234
  when String
233
235
  begin
234
236
  @lazy_zones_map[arg] ||= create(arg)
235
237
  rescue TZInfo::InvalidTimezoneIdentifier
236
238
  nil
237
239
  end
240
+ when TZInfo::Timezone
241
+ @lazy_zones_map[arg.name] ||= create(arg.name, nil, arg)
238
242
  when Numeric, ActiveSupport::Duration
239
243
  arg *= 3600 if arg.abs <= 13
240
244
  all.find { |z| z.utc_offset == arg.to_i }
@@ -256,7 +260,7 @@ module ActiveSupport
256
260
  @country_zones[code] ||= load_country_zones(code)
257
261
  end
258
262
 
259
- def clear #:nodoc:
263
+ def clear # :nodoc:
260
264
  @lazy_zones_map = Concurrent::Map.new
261
265
  @country_zones = Concurrent::Map.new
262
266
  @zones = nil
@@ -381,16 +385,28 @@ module ActiveSupport
381
385
  # If the string is invalid then an +ArgumentError+ will be raised unlike +parse+
382
386
  # which usually returns +nil+ when given an invalid date string.
383
387
  def iso8601(str)
388
+ # Historically `Date._iso8601(nil)` returns `{}`, but in the `date` gem versions `3.2.1`, `3.1.2`, `3.0.2`,
389
+ # and `2.0.1`, `Date._iso8601(nil)` raises `TypeError` https://github.com/ruby/date/issues/39
390
+ # Future `date` releases are expected to revert back to the original behavior.
384
391
  raise ArgumentError, "invalid date" if str.nil?
385
392
 
386
393
  parts = Date._iso8601(str)
387
394
 
388
- raise ArgumentError, "invalid date" if parts.empty?
395
+ year = parts.fetch(:year)
396
+
397
+ if parts.key?(:yday)
398
+ ordinal_date = Date.ordinal(year, parts.fetch(:yday))
399
+ month = ordinal_date.month
400
+ day = ordinal_date.day
401
+ else
402
+ month = parts.fetch(:mon)
403
+ day = parts.fetch(:mday)
404
+ end
389
405
 
390
406
  time = Time.new(
391
- parts.fetch(:year),
392
- parts.fetch(:mon),
393
- parts.fetch(:mday),
407
+ year,
408
+ month,
409
+ day,
394
410
  parts.fetch(:hour, 0),
395
411
  parts.fetch(:min, 0),
396
412
  parts.fetch(:sec, 0) + parts.fetch(:sec_fraction, 0),
@@ -402,6 +418,9 @@ module ActiveSupport
402
418
  else
403
419
  TimeWithZone.new(nil, self, time)
404
420
  end
421
+
422
+ rescue Date::Error, KeyError
423
+ raise ArgumentError, "invalid date"
405
424
  end
406
425
 
407
426
  # Method for creating new ActiveSupport::TimeWithZone instance in time zone
@@ -514,7 +533,7 @@ module ActiveSupport
514
533
  def utc_to_local(time)
515
534
  tzinfo.utc_to_local(time).yield_self do |t|
516
535
  ActiveSupport.utc_to_local_returns_utc_offset_times ?
517
- t : Time.utc(t.year, t.month, t.day, t.hour, t.min, t.sec, t.sec_fraction)
536
+ t : Time.utc(t.year, t.month, t.day, t.hour, t.min, t.sec, t.sec_fraction * 1_000_000)
518
537
  end
519
538
  end
520
539
 
@@ -524,27 +543,27 @@ module ActiveSupport
524
543
  tzinfo.local_to_utc(time, dst)
525
544
  end
526
545
 
527
- # Available so that TimeZone instances respond like TZInfo::Timezone
546
+ # Available so that TimeZone instances respond like <tt>TZInfo::Timezone</tt>
528
547
  # instances.
529
548
  def period_for_utc(time)
530
549
  tzinfo.period_for_utc(time)
531
550
  end
532
551
 
533
- # Available so that TimeZone instances respond like TZInfo::Timezone
552
+ # Available so that TimeZone instances respond like <tt>TZInfo::Timezone</tt>
534
553
  # instances.
535
554
  def period_for_local(time, dst = true)
536
555
  tzinfo.period_for_local(time, dst) { |periods| periods.last }
537
556
  end
538
557
 
539
- def periods_for_local(time) #:nodoc:
558
+ def periods_for_local(time) # :nodoc:
540
559
  tzinfo.periods_for_local(time)
541
560
  end
542
561
 
543
- def init_with(coder) #:nodoc:
562
+ def init_with(coder) # :nodoc:
544
563
  initialize(coder["name"])
545
564
  end
546
565
 
547
- def encode_with(coder) #:nodoc:
566
+ def encode_with(coder) # :nodoc:
548
567
  coder.tag = "!ruby/object:#{self.class}"
549
568
  coder.map = { "name" => tzinfo.name }
550
569
  end
@@ -3,7 +3,7 @@
3
3
  require_relative "gem_version"
4
4
 
5
5
  module ActiveSupport
6
- # Returns the version of the currently loaded ActiveSupport as a <tt>Gem::Version</tt>
6
+ # Returns the currently loaded version of Active Support as a <tt>Gem::Version</tt>.
7
7
  def self.version
8
8
  gem_version
9
9
  end
@@ -15,7 +15,7 @@ java_import org.xml.sax.Attributes unless defined? Attributes
15
15
  java_import org.w3c.dom.Node unless defined? Node
16
16
 
17
17
  module ActiveSupport
18
- module XmlMini_JDOM #:nodoc:
18
+ module XmlMini_JDOM # :nodoc:
19
19
  extend self
20
20
 
21
21
  CONTENT_KEY = "__content__"
@@ -5,7 +5,7 @@ require "active_support/core_ext/object/blank"
5
5
  require "stringio"
6
6
 
7
7
  module ActiveSupport
8
- module XmlMini_LibXML #:nodoc:
8
+ module XmlMini_LibXML # :nodoc:
9
9
  extend self
10
10
 
11
11
  # Parse an XML Document string or IO into a simple hash using libxml.
@@ -25,15 +25,15 @@ module ActiveSupport
25
25
  end
26
26
  end
27
27
 
28
- module LibXML #:nodoc:
29
- module Conversions #:nodoc:
30
- module Document #:nodoc:
28
+ module LibXML # :nodoc:
29
+ module Conversions # :nodoc:
30
+ module Document # :nodoc:
31
31
  def to_hash
32
32
  root.to_hash
33
33
  end
34
34
  end
35
35
 
36
- module Node #:nodoc:
36
+ module Node # :nodoc:
37
37
  CONTENT_ROOT = "__content__"
38
38
 
39
39
  # Convert XML document to hash.
@@ -5,7 +5,7 @@ require "active_support/core_ext/object/blank"
5
5
  require "stringio"
6
6
 
7
7
  module ActiveSupport
8
- module XmlMini_LibXMLSAX #:nodoc:
8
+ module XmlMini_LibXMLSAX # :nodoc:
9
9
  extend self
10
10
 
11
11
  # Class that will build the hash while the XML document
@@ -10,7 +10,7 @@ require "active_support/core_ext/object/blank"
10
10
  require "stringio"
11
11
 
12
12
  module ActiveSupport
13
- module XmlMini_Nokogiri #:nodoc:
13
+ module XmlMini_Nokogiri # :nodoc:
14
14
  extend self
15
15
 
16
16
  # Parse an XML Document string or IO into a simple hash using libxml / nokogiri.
@@ -30,14 +30,14 @@ module ActiveSupport
30
30
  end
31
31
  end
32
32
 
33
- module Conversions #:nodoc:
34
- module Document #:nodoc:
33
+ module Conversions # :nodoc:
34
+ module Document # :nodoc:
35
35
  def to_hash
36
36
  root.to_hash
37
37
  end
38
38
  end
39
39
 
40
- module Node #:nodoc:
40
+ module Node # :nodoc:
41
41
  CONTENT_ROOT = "__content__"
42
42
 
43
43
  # Convert XML document to hash.
@@ -10,7 +10,7 @@ require "active_support/core_ext/object/blank"
10
10
  require "stringio"
11
11
 
12
12
  module ActiveSupport
13
- module XmlMini_NokogiriSAX #:nodoc:
13
+ module XmlMini_NokogiriSAX # :nodoc:
14
14
  extend self
15
15
 
16
16
  # Class that will build the hash while the XML document
@@ -5,7 +5,7 @@ require "active_support/core_ext/object/blank"
5
5
  require "stringio"
6
6
 
7
7
  module ActiveSupport
8
- module XmlMini_REXML #:nodoc:
8
+ module XmlMini_REXML # :nodoc:
9
9
  extend self
10
10
 
11
11
  CONTENT_KEY = "__content__"
@@ -19,7 +19,7 @@ module ActiveSupport
19
19
 
20
20
  # This module decorates files deserialized using Hash.from_xml with
21
21
  # the <tt>original_filename</tt> and <tt>content_type</tt> methods.
22
- module FileLike #:nodoc:
22
+ module FileLike # :nodoc:
23
23
  attr_writer :original_filename, :content_type
24
24
 
25
25
  def original_filename
@@ -50,10 +50,11 @@ module ActiveSupport
50
50
  "Hash" => "hash"
51
51
  }
52
52
  end
53
+ TYPE_NAMES["ActiveSupport::TimeWithZone"] = TYPE_NAMES["Time"]
53
54
 
54
55
  FORMATTING = {
55
56
  "symbol" => Proc.new { |symbol| symbol.to_s },
56
- "date" => Proc.new { |date| date.to_s(:db) },
57
+ "date" => Proc.new { |date| date.to_fs(:db) },
57
58
  "dateTime" => Proc.new { |time| time.xmlschema },
58
59
  "binary" => Proc.new { |binary| ::Base64.encode64(binary) },
59
60
  "yaml" => Proc.new { |yaml| yaml.to_yaml }
@@ -180,11 +181,11 @@ module ActiveSupport
180
181
  end
181
182
 
182
183
  def current_thread_backend
183
- Thread.current[:xml_mini_backend]
184
+ IsolatedExecutionState[:xml_mini_backend]
184
185
  end
185
186
 
186
187
  def current_thread_backend=(name)
187
- Thread.current[:xml_mini_backend] = name && cast_backend_name_to_module(name)
188
+ IsolatedExecutionState[:xml_mini_backend] = name && cast_backend_name_to_module(name)
188
189
  end
189
190
 
190
191
  def cast_backend_name_to_module(name)
@@ -34,19 +34,24 @@ module ActiveSupport
34
34
  extend ActiveSupport::Autoload
35
35
 
36
36
  autoload :Concern
37
+ autoload :CodeGenerator
37
38
  autoload :ActionableError
38
39
  autoload :ConfigurationFile
39
40
  autoload :CurrentAttributes
40
41
  autoload :Dependencies
41
42
  autoload :DescendantsTracker
43
+ autoload :ExecutionContext
42
44
  autoload :ExecutionWrapper
43
45
  autoload :Executor
46
+ autoload :ErrorReporter
44
47
  autoload :FileUpdateChecker
45
48
  autoload :EventedFileUpdateChecker
46
49
  autoload :ForkTracker
47
50
  autoload :LogSubscriber
51
+ autoload :IsolatedExecutionState
48
52
  autoload :Notifications
49
53
  autoload :Reloader
54
+ autoload :PerThreadRegistry
50
55
  autoload :SecureCompareRotator
51
56
 
52
57
  eager_autoload do
@@ -87,6 +92,17 @@ module ActiveSupport
87
92
  end
88
93
 
89
94
  cattr_accessor :test_order # :nodoc:
95
+ cattr_accessor :test_parallelization_threshold, default: 50 # :nodoc:
96
+
97
+ singleton_class.attr_accessor :error_reporter # :nodoc:
98
+
99
+ def self.cache_format_version
100
+ Cache.format_version
101
+ end
102
+
103
+ def self.cache_format_version=(value)
104
+ Cache.format_version = value
105
+ end
90
106
 
91
107
  def self.to_time_preserves_timezone
92
108
  DateAndTime::Compatibility.preserve_timezone
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activesupport
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.6.1
4
+ version: 7.0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -64,20 +64,6 @@ dependencies:
64
64
  - - ">="
65
65
  - !ruby/object:Gem::Version
66
66
  version: 1.0.2
67
- - !ruby/object:Gem::Dependency
68
- name: zeitwerk
69
- requirement: !ruby/object:Gem::Requirement
70
- requirements:
71
- - - "~>"
72
- - !ruby/object:Gem::Version
73
- version: '2.3'
74
- type: :runtime
75
- prerelease: false
76
- version_requirements: !ruby/object:Gem::Requirement
77
- requirements:
78
- - - "~>"
79
- - !ruby/object:Gem::Version
80
- version: '2.3'
81
67
  - !ruby/object:Gem::Dependency
82
68
  name: minitest
83
69
  requirement: !ruby/object:Gem::Requirement
@@ -119,6 +105,7 @@ files:
119
105
  - lib/active_support/cache/strategy/local_cache.rb
120
106
  - lib/active_support/cache/strategy/local_cache_middleware.rb
121
107
  - lib/active_support/callbacks.rb
108
+ - lib/active_support/code_generator.rb
122
109
  - lib/active_support/concern.rb
123
110
  - lib/active_support/concurrency/load_interlock_aware_monitor.rb
124
111
  - lib/active_support/concurrency/share_lock.rb
@@ -128,6 +115,7 @@ files:
128
115
  - lib/active_support/core_ext/array.rb
129
116
  - lib/active_support/core_ext/array/access.rb
130
117
  - lib/active_support/core_ext/array/conversions.rb
118
+ - lib/active_support/core_ext/array/deprecated_conversions.rb
131
119
  - lib/active_support/core_ext/array/extract.rb
132
120
  - lib/active_support/core_ext/array/extract_options.rb
133
121
  - lib/active_support/core_ext/array/grouping.rb
@@ -145,6 +133,7 @@ files:
145
133
  - lib/active_support/core_ext/date/blank.rb
146
134
  - lib/active_support/core_ext/date/calculations.rb
147
135
  - lib/active_support/core_ext/date/conversions.rb
136
+ - lib/active_support/core_ext/date/deprecated_conversions.rb
148
137
  - lib/active_support/core_ext/date/zones.rb
149
138
  - lib/active_support/core_ext/date_and_time/calculations.rb
150
139
  - lib/active_support/core_ext/date_and_time/compatibility.rb
@@ -155,6 +144,7 @@ files:
155
144
  - lib/active_support/core_ext/date_time/calculations.rb
156
145
  - lib/active_support/core_ext/date_time/compatibility.rb
157
146
  - lib/active_support/core_ext/date_time/conversions.rb
147
+ - lib/active_support/core_ext/date_time/deprecated_conversions.rb
158
148
  - lib/active_support/core_ext/digest.rb
159
149
  - lib/active_support/core_ext/digest/uuid.rb
160
150
  - lib/active_support/core_ext/enumerable.rb
@@ -178,7 +168,6 @@ files:
178
168
  - lib/active_support/core_ext/kernel/reporting.rb
179
169
  - lib/active_support/core_ext/kernel/singleton_class.rb
180
170
  - lib/active_support/core_ext/load_error.rb
181
- - lib/active_support/core_ext/marshal.rb
182
171
  - lib/active_support/core_ext/module.rb
183
172
  - lib/active_support/core_ext/module/aliasing.rb
184
173
  - lib/active_support/core_ext/module/anonymous.rb
@@ -195,6 +184,7 @@ files:
195
184
  - lib/active_support/core_ext/numeric.rb
196
185
  - lib/active_support/core_ext/numeric/bytes.rb
197
186
  - lib/active_support/core_ext/numeric/conversions.rb
187
+ - lib/active_support/core_ext/numeric/deprecated_conversions.rb
198
188
  - lib/active_support/core_ext/numeric/time.rb
199
189
  - lib/active_support/core_ext/object.rb
200
190
  - lib/active_support/core_ext/object/acts_like.rb
@@ -209,9 +199,12 @@ files:
209
199
  - lib/active_support/core_ext/object/to_query.rb
210
200
  - lib/active_support/core_ext/object/try.rb
211
201
  - lib/active_support/core_ext/object/with_options.rb
202
+ - lib/active_support/core_ext/pathname.rb
203
+ - lib/active_support/core_ext/pathname/existence.rb
212
204
  - lib/active_support/core_ext/range.rb
213
205
  - lib/active_support/core_ext/range/compare_range.rb
214
206
  - lib/active_support/core_ext/range/conversions.rb
207
+ - lib/active_support/core_ext/range/deprecated_conversions.rb
215
208
  - lib/active_support/core_ext/range/each.rb
216
209
  - lib/active_support/core_ext/range/include_time_with_zone.rb
217
210
  - lib/active_support/core_ext/range/overlaps.rb
@@ -238,6 +231,7 @@ files:
238
231
  - lib/active_support/core_ext/time/calculations.rb
239
232
  - lib/active_support/core_ext/time/compatibility.rb
240
233
  - lib/active_support/core_ext/time/conversions.rb
234
+ - lib/active_support/core_ext/time/deprecated_conversions.rb
241
235
  - lib/active_support/core_ext/time/zones.rb
242
236
  - lib/active_support/core_ext/uri.rb
243
237
  - lib/active_support/current_attributes.rb
@@ -245,7 +239,7 @@ files:
245
239
  - lib/active_support/dependencies.rb
246
240
  - lib/active_support/dependencies/autoload.rb
247
241
  - lib/active_support/dependencies/interlock.rb
248
- - lib/active_support/dependencies/zeitwerk_integration.rb
242
+ - lib/active_support/dependencies/require_dependency.rb
249
243
  - lib/active_support/deprecation.rb
250
244
  - lib/active_support/deprecation/behaviors.rb
251
245
  - lib/active_support/deprecation/constant_accessor.rb
@@ -262,14 +256,19 @@ files:
262
256
  - lib/active_support/encrypted_configuration.rb
263
257
  - lib/active_support/encrypted_file.rb
264
258
  - lib/active_support/environment_inquirer.rb
259
+ - lib/active_support/error_reporter.rb
265
260
  - lib/active_support/evented_file_update_checker.rb
261
+ - lib/active_support/execution_context.rb
262
+ - lib/active_support/execution_context/test_helper.rb
266
263
  - lib/active_support/execution_wrapper.rb
267
264
  - lib/active_support/executor.rb
265
+ - lib/active_support/executor/test_helper.rb
268
266
  - lib/active_support/file_update_checker.rb
269
267
  - lib/active_support/fork_tracker.rb
270
268
  - lib/active_support/gem_version.rb
271
269
  - lib/active_support/gzip.rb
272
270
  - lib/active_support/hash_with_indifferent_access.rb
271
+ - lib/active_support/html_safe_translation.rb
273
272
  - lib/active_support/i18n.rb
274
273
  - lib/active_support/i18n_railtie.rb
275
274
  - lib/active_support/inflections.rb
@@ -277,6 +276,7 @@ files:
277
276
  - lib/active_support/inflector/inflections.rb
278
277
  - lib/active_support/inflector/methods.rb
279
278
  - lib/active_support/inflector/transliterate.rb
279
+ - lib/active_support/isolated_execution_state.rb
280
280
  - lib/active_support/json.rb
281
281
  - lib/active_support/json/decoding.rb
282
282
  - lib/active_support/json/encoding.rb
@@ -320,6 +320,7 @@ files:
320
320
  - lib/active_support/railtie.rb
321
321
  - lib/active_support/reloader.rb
322
322
  - lib/active_support/rescuable.rb
323
+ - lib/active_support/ruby_features.rb
323
324
  - lib/active_support/secure_compare_rotator.rb
324
325
  - lib/active_support/security_utils.rb
325
326
  - lib/active_support/string_inquirer.rb
@@ -337,6 +338,7 @@ files:
337
338
  - lib/active_support/testing/parallelization.rb
338
339
  - lib/active_support/testing/parallelization/server.rb
339
340
  - lib/active_support/testing/parallelization/worker.rb
341
+ - lib/active_support/testing/parallelize_executor.rb
340
342
  - lib/active_support/testing/setup_and_teardown.rb
341
343
  - lib/active_support/testing/stream.rb
342
344
  - lib/active_support/testing/tagged_logging.rb
@@ -357,10 +359,10 @@ licenses:
357
359
  - MIT
358
360
  metadata:
359
361
  bug_tracker_uri: https://github.com/rails/rails/issues
360
- changelog_uri: https://github.com/rails/rails/blob/v6.1.6.1/activesupport/CHANGELOG.md
361
- documentation_uri: https://api.rubyonrails.org/v6.1.6.1/
362
+ changelog_uri: https://github.com/rails/rails/blob/v7.0.3.1/activesupport/CHANGELOG.md
363
+ documentation_uri: https://api.rubyonrails.org/v7.0.3.1/
362
364
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
363
- source_code_uri: https://github.com/rails/rails/tree/v6.1.6.1/activesupport
365
+ source_code_uri: https://github.com/rails/rails/tree/v7.0.3.1/activesupport
364
366
  rubygems_mfa_required: 'true'
365
367
  post_install_message:
366
368
  rdoc_options:
@@ -372,7 +374,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
372
374
  requirements:
373
375
  - - ">="
374
376
  - !ruby/object:Gem::Version
375
- version: 2.5.0
377
+ version: 2.7.0
376
378
  required_rubygems_version: !ruby/object:Gem::Requirement
377
379
  requirements:
378
380
  - - ">="
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "active_support/core_ext/string/inflections"
4
-
5
- module ActiveSupport
6
- module MarshalWithAutoloading # :nodoc:
7
- def load(source, proc = nil)
8
- super(source, proc)
9
- rescue ArgumentError, NameError => exc
10
- if exc.message.match(%r|undefined class/module (.+?)(?:::)?\z|)
11
- # try loading the class/module
12
- loaded = $1.constantize
13
-
14
- raise unless $1 == loaded.name
15
-
16
- # if it is an IO we need to go back to read the object
17
- source.rewind if source.respond_to?(:rewind)
18
- retry
19
- else
20
- raise exc
21
- end
22
- end
23
- end
24
- end
25
-
26
- Marshal.singleton_class.prepend(ActiveSupport::MarshalWithAutoloading)
@@ -1,120 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "set"
4
- require "active_support/core_ext/string/inflections"
5
-
6
- module ActiveSupport
7
- module Dependencies
8
- module ZeitwerkIntegration # :nodoc: all
9
- module Decorations
10
- def clear
11
- Dependencies.unload_interlock do
12
- Rails.autoloaders.main.reload
13
- rescue Zeitwerk::ReloadingDisabledError
14
- raise "reloading is disabled because config.cache_classes is true"
15
- end
16
- end
17
-
18
- def constantize(cpath)
19
- ActiveSupport::Inflector.constantize(cpath)
20
- end
21
-
22
- def safe_constantize(cpath)
23
- ActiveSupport::Inflector.safe_constantize(cpath)
24
- end
25
-
26
- def autoloaded_constants
27
- Rails.autoloaders.main.unloadable_cpaths
28
- end
29
-
30
- def autoloaded?(object)
31
- cpath = object.is_a?(Module) ? real_mod_name(object) : object.to_s
32
- Rails.autoloaders.main.unloadable_cpath?(cpath)
33
- end
34
-
35
- def verbose=(verbose)
36
- l = verbose ? logger || Rails.logger : nil
37
- Rails.autoloaders.each { |autoloader| autoloader.logger = l }
38
- end
39
-
40
- def unhook!
41
- :no_op
42
- end
43
- end
44
-
45
- module RequireDependency
46
- def require_dependency(filename)
47
- filename = filename.to_path if filename.respond_to?(:to_path)
48
- if abspath = ActiveSupport::Dependencies.search_for_file(filename)
49
- require abspath
50
- else
51
- require filename
52
- end
53
- end
54
- end
55
-
56
- module Inflector
57
- # Concurrent::Map is not needed. This is a private class, and overrides
58
- # must be defined while the application boots.
59
- @overrides = {}
60
-
61
- def self.camelize(basename, _abspath)
62
- @overrides[basename] || basename.camelize
63
- end
64
-
65
- def self.inflect(overrides)
66
- @overrides.merge!(overrides)
67
- end
68
- end
69
-
70
- class << self
71
- def take_over(enable_reloading:)
72
- setup_autoloaders(enable_reloading)
73
- freeze_paths
74
- decorate_dependencies
75
- end
76
-
77
- private
78
- def setup_autoloaders(enable_reloading)
79
- Dependencies.autoload_paths.each do |autoload_path|
80
- # Zeitwerk only accepts existing directories in `push_dir` to
81
- # prevent misconfigurations.
82
- next unless File.directory?(autoload_path)
83
-
84
- autoloader = \
85
- autoload_once?(autoload_path) ? Rails.autoloaders.once : Rails.autoloaders.main
86
-
87
- autoloader.push_dir(autoload_path)
88
- autoloader.do_not_eager_load(autoload_path) unless eager_load?(autoload_path)
89
- end
90
-
91
- Rails.autoloaders.main.enable_reloading if enable_reloading
92
-
93
- # Order matters.
94
- Rails.autoloaders.once.setup
95
- Rails.autoloaders.main.setup
96
- end
97
-
98
- def autoload_once?(autoload_path)
99
- Dependencies.autoload_once_paths.include?(autoload_path)
100
- end
101
-
102
- def eager_load?(autoload_path)
103
- Dependencies._eager_load_paths.member?(autoload_path)
104
- end
105
-
106
- def freeze_paths
107
- Dependencies.autoload_paths.freeze
108
- Dependencies.autoload_once_paths.freeze
109
- Dependencies._eager_load_paths.freeze
110
- end
111
-
112
- def decorate_dependencies
113
- Dependencies.unhook!
114
- Dependencies.singleton_class.prepend(Decorations)
115
- Object.prepend(RequireDependency)
116
- end
117
- end
118
- end
119
- end
120
- end