activesupport 7.0.8.4 → 7.1.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +730 -307
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +4 -4
  5. data/lib/active_support/actionable_error.rb +3 -1
  6. data/lib/active_support/array_inquirer.rb +2 -0
  7. data/lib/active_support/backtrace_cleaner.rb +25 -5
  8. data/lib/active_support/benchmarkable.rb +1 -0
  9. data/lib/active_support/builder.rb +1 -1
  10. data/lib/active_support/cache/coder.rb +153 -0
  11. data/lib/active_support/cache/entry.rb +128 -0
  12. data/lib/active_support/cache/file_store.rb +36 -9
  13. data/lib/active_support/cache/mem_cache_store.rb +84 -68
  14. data/lib/active_support/cache/memory_store.rb +76 -24
  15. data/lib/active_support/cache/null_store.rb +6 -0
  16. data/lib/active_support/cache/redis_cache_store.rb +126 -131
  17. data/lib/active_support/cache/serializer_with_fallback.rb +175 -0
  18. data/lib/active_support/cache/strategy/local_cache.rb +20 -8
  19. data/lib/active_support/cache.rb +304 -246
  20. data/lib/active_support/callbacks.rb +38 -18
  21. data/lib/active_support/concern.rb +4 -2
  22. data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +42 -3
  23. data/lib/active_support/concurrency/null_lock.rb +13 -0
  24. data/lib/active_support/configurable.rb +10 -0
  25. data/lib/active_support/core_ext/array/conversions.rb +2 -1
  26. data/lib/active_support/core_ext/array.rb +0 -1
  27. data/lib/active_support/core_ext/class/subclasses.rb +13 -10
  28. data/lib/active_support/core_ext/date/conversions.rb +1 -0
  29. data/lib/active_support/core_ext/date.rb +0 -1
  30. data/lib/active_support/core_ext/date_and_time/calculations.rb +10 -0
  31. data/lib/active_support/core_ext/date_time/conversions.rb +6 -2
  32. data/lib/active_support/core_ext/date_time.rb +0 -1
  33. data/lib/active_support/core_ext/digest/uuid.rb +1 -10
  34. data/lib/active_support/core_ext/enumerable.rb +3 -75
  35. data/lib/active_support/core_ext/erb/util.rb +196 -0
  36. data/lib/active_support/core_ext/hash/conversions.rb +1 -1
  37. data/lib/active_support/core_ext/module/attribute_accessors.rb +6 -0
  38. data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +34 -16
  39. data/lib/active_support/core_ext/module/delegation.rb +40 -11
  40. data/lib/active_support/core_ext/module/deprecation.rb +15 -12
  41. data/lib/active_support/core_ext/module/introspection.rb +0 -1
  42. data/lib/active_support/core_ext/numeric/bytes.rb +9 -0
  43. data/lib/active_support/core_ext/numeric/conversions.rb +2 -0
  44. data/lib/active_support/core_ext/numeric.rb +0 -1
  45. data/lib/active_support/core_ext/object/deep_dup.rb +16 -0
  46. data/lib/active_support/core_ext/object/inclusion.rb +13 -5
  47. data/lib/active_support/core_ext/object/instance_variables.rb +22 -12
  48. data/lib/active_support/core_ext/object/json.rb +10 -2
  49. data/lib/active_support/core_ext/object/with.rb +44 -0
  50. data/lib/active_support/core_ext/object/with_options.rb +3 -3
  51. data/lib/active_support/core_ext/object.rb +1 -0
  52. data/lib/active_support/core_ext/pathname/blank.rb +16 -0
  53. data/lib/active_support/core_ext/pathname/existence.rb +2 -0
  54. data/lib/active_support/core_ext/pathname.rb +1 -0
  55. data/lib/active_support/core_ext/range/conversions.rb +28 -7
  56. data/lib/active_support/core_ext/range/{overlaps.rb → overlap.rb} +5 -3
  57. data/lib/active_support/core_ext/range.rb +1 -2
  58. data/lib/active_support/core_ext/securerandom.rb +24 -12
  59. data/lib/active_support/core_ext/string/filters.rb +20 -14
  60. data/lib/active_support/core_ext/string/inflections.rb +16 -5
  61. data/lib/active_support/core_ext/string/output_safety.rb +38 -174
  62. data/lib/active_support/core_ext/thread/backtrace/location.rb +12 -0
  63. data/lib/active_support/core_ext/time/calculations.rb +18 -2
  64. data/lib/active_support/core_ext/time/conversions.rb +2 -2
  65. data/lib/active_support/core_ext/time/zones.rb +4 -4
  66. data/lib/active_support/core_ext/time.rb +0 -1
  67. data/lib/active_support/current_attributes.rb +15 -6
  68. data/lib/active_support/dependencies/autoload.rb +17 -12
  69. data/lib/active_support/deprecation/behaviors.rb +53 -32
  70. data/lib/active_support/deprecation/constant_accessor.rb +5 -4
  71. data/lib/active_support/deprecation/deprecators.rb +104 -0
  72. data/lib/active_support/deprecation/disallowed.rb +3 -5
  73. data/lib/active_support/deprecation/instance_delegator.rb +31 -4
  74. data/lib/active_support/deprecation/method_wrappers.rb +6 -23
  75. data/lib/active_support/deprecation/proxy_wrappers.rb +37 -22
  76. data/lib/active_support/deprecation/reporting.rb +35 -21
  77. data/lib/active_support/deprecation.rb +32 -5
  78. data/lib/active_support/deprecator.rb +7 -0
  79. data/lib/active_support/descendants_tracker.rb +104 -132
  80. data/lib/active_support/duration/iso8601_serializer.rb +0 -2
  81. data/lib/active_support/duration.rb +2 -1
  82. data/lib/active_support/encrypted_configuration.rb +30 -9
  83. data/lib/active_support/encrypted_file.rb +8 -3
  84. data/lib/active_support/environment_inquirer.rb +22 -2
  85. data/lib/active_support/error_reporter/test_helper.rb +15 -0
  86. data/lib/active_support/error_reporter.rb +121 -35
  87. data/lib/active_support/execution_wrapper.rb +4 -4
  88. data/lib/active_support/file_update_checker.rb +4 -2
  89. data/lib/active_support/fork_tracker.rb +10 -2
  90. data/lib/active_support/gem_version.rb +4 -4
  91. data/lib/active_support/gzip.rb +2 -0
  92. data/lib/active_support/hash_with_indifferent_access.rb +35 -17
  93. data/lib/active_support/i18n.rb +1 -1
  94. data/lib/active_support/i18n_railtie.rb +20 -13
  95. data/lib/active_support/inflector/inflections.rb +2 -0
  96. data/lib/active_support/inflector/methods.rb +22 -10
  97. data/lib/active_support/inflector/transliterate.rb +3 -1
  98. data/lib/active_support/isolated_execution_state.rb +26 -22
  99. data/lib/active_support/json/decoding.rb +2 -1
  100. data/lib/active_support/json/encoding.rb +25 -43
  101. data/lib/active_support/key_generator.rb +9 -1
  102. data/lib/active_support/lazy_load_hooks.rb +6 -4
  103. data/lib/active_support/locale/en.yml +2 -0
  104. data/lib/active_support/log_subscriber.rb +78 -33
  105. data/lib/active_support/logger.rb +1 -1
  106. data/lib/active_support/logger_thread_safe_level.rb +9 -21
  107. data/lib/active_support/message_encryptor.rb +197 -53
  108. data/lib/active_support/message_encryptors.rb +140 -0
  109. data/lib/active_support/message_pack/cache_serializer.rb +23 -0
  110. data/lib/active_support/message_pack/extensions.rb +292 -0
  111. data/lib/active_support/message_pack/serializer.rb +63 -0
  112. data/lib/active_support/message_pack.rb +50 -0
  113. data/lib/active_support/message_verifier.rb +212 -93
  114. data/lib/active_support/message_verifiers.rb +134 -0
  115. data/lib/active_support/messages/codec.rb +65 -0
  116. data/lib/active_support/messages/metadata.rb +111 -45
  117. data/lib/active_support/messages/rotation_coordinator.rb +93 -0
  118. data/lib/active_support/messages/rotator.rb +34 -32
  119. data/lib/active_support/messages/serializer_with_fallback.rb +158 -0
  120. data/lib/active_support/multibyte/chars.rb +2 -0
  121. data/lib/active_support/multibyte/unicode.rb +9 -37
  122. data/lib/active_support/notifications/fanout.rb +239 -81
  123. data/lib/active_support/notifications/instrumenter.rb +71 -14
  124. data/lib/active_support/notifications.rb +1 -1
  125. data/lib/active_support/number_helper/number_converter.rb +2 -2
  126. data/lib/active_support/number_helper/number_to_human_size_converter.rb +1 -1
  127. data/lib/active_support/number_helper/number_to_phone_converter.rb +1 -0
  128. data/lib/active_support/ordered_hash.rb +3 -3
  129. data/lib/active_support/ordered_options.rb +14 -0
  130. data/lib/active_support/parameter_filter.rb +84 -69
  131. data/lib/active_support/proxy_object.rb +2 -0
  132. data/lib/active_support/railtie.rb +33 -21
  133. data/lib/active_support/reloader.rb +12 -4
  134. data/lib/active_support/rescuable.rb +2 -0
  135. data/lib/active_support/secure_compare_rotator.rb +16 -9
  136. data/lib/active_support/string_inquirer.rb +3 -1
  137. data/lib/active_support/subscriber.rb +9 -27
  138. data/lib/active_support/syntax_error_proxy.rb +49 -0
  139. data/lib/active_support/tagged_logging.rb +60 -24
  140. data/lib/active_support/test_case.rb +153 -6
  141. data/lib/active_support/testing/assertions.rb +25 -9
  142. data/lib/active_support/testing/autorun.rb +0 -2
  143. data/lib/active_support/testing/constant_stubbing.rb +32 -0
  144. data/lib/active_support/testing/deprecation.rb +25 -25
  145. data/lib/active_support/testing/error_reporter_assertions.rb +108 -0
  146. data/lib/active_support/testing/isolation.rb +1 -1
  147. data/lib/active_support/testing/method_call_assertions.rb +21 -8
  148. data/lib/active_support/testing/parallelize_executor.rb +8 -3
  149. data/lib/active_support/testing/stream.rb +1 -1
  150. data/lib/active_support/testing/strict_warnings.rb +38 -0
  151. data/lib/active_support/testing/time_helpers.rb +32 -14
  152. data/lib/active_support/time_with_zone.rb +4 -14
  153. data/lib/active_support/values/time_zone.rb +9 -7
  154. data/lib/active_support/version.rb +1 -1
  155. data/lib/active_support/xml_mini/jdom.rb +3 -10
  156. data/lib/active_support/xml_mini/nokogiri.rb +1 -1
  157. data/lib/active_support/xml_mini/nokogirisax.rb +1 -1
  158. data/lib/active_support/xml_mini/rexml.rb +1 -1
  159. data/lib/active_support/xml_mini.rb +2 -2
  160. data/lib/active_support.rb +13 -3
  161. metadata +103 -18
  162. data/lib/active_support/core_ext/array/deprecated_conversions.rb +0 -25
  163. data/lib/active_support/core_ext/date/deprecated_conversions.rb +0 -40
  164. data/lib/active_support/core_ext/date_time/deprecated_conversions.rb +0 -36
  165. data/lib/active_support/core_ext/numeric/deprecated_conversions.rb +0 -60
  166. data/lib/active_support/core_ext/range/deprecated_conversions.rb +0 -36
  167. data/lib/active_support/core_ext/range/include_time_with_zone.rb +0 -5
  168. data/lib/active_support/core_ext/time/deprecated_conversions.rb +0 -73
  169. data/lib/active_support/core_ext/uri.rb +0 -5
  170. data/lib/active_support/per_thread_registry.rb +0 -65
@@ -2,7 +2,6 @@
2
2
 
3
3
  require "active_support/core_ext/module/redefine_method"
4
4
  require "active_support/core_ext/time/calculations"
5
- require "concurrent/map"
6
5
 
7
6
  module ActiveSupport
8
7
  module Testing
@@ -11,7 +10,7 @@ module ActiveSupport
11
10
  Stub = Struct.new(:object, :method_name, :original_method)
12
11
 
13
12
  def initialize
14
- @stubs = Concurrent::Map.new { |h, k| h[k] = {} }
13
+ @stubs = Hash.new { |h, k| h[k] = {} }
15
14
  end
16
15
 
17
16
  # Stubs object.method_name with the given block
@@ -76,6 +75,11 @@ module ActiveSupport
76
75
  # stubbing +Time.now+, +Date.today+, and +DateTime.now+. The stubs are automatically removed
77
76
  # at the end of the test.
78
77
  #
78
+ # Note that the usec for the resulting time will be set to 0 to prevent rounding
79
+ # errors with external services, like MySQL (which will round instead of floor,
80
+ # leading to off-by-one-second errors), unless the <tt>with_usec</tt> argument
81
+ # is set to <tt>true</tt>.
82
+ #
79
83
  # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
80
84
  # travel 1.day
81
85
  # Time.current # => Sun, 10 Nov 2013 15:34:49 EST -05:00
@@ -90,11 +94,11 @@ module ActiveSupport
90
94
  # User.create.created_at # => Sun, 10 Nov 2013 15:34:49 EST -05:00
91
95
  # end
92
96
  # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
93
- def travel(duration, &block)
94
- travel_to Time.now + duration, &block
97
+ def travel(duration, with_usec: false, &block)
98
+ travel_to Time.now + duration, with_usec: with_usec, &block
95
99
  end
96
100
 
97
- # Changes current time to the given time by stubbing +Time.now+,
101
+ # Changes current time to the given time by stubbing +Time.now+, +Time.new+,
98
102
  # +Date.today+, and +DateTime.now+ to return the time or date passed into this method.
99
103
  # The stubs are automatically removed at the end of the test.
100
104
  #
@@ -115,7 +119,8 @@ module ActiveSupport
115
119
  #
116
120
  # Note that the usec for the time passed will be set to 0 to prevent rounding
117
121
  # errors with external services, like MySQL (which will round instead of floor,
118
- # leading to off-by-one-second errors).
122
+ # leading to off-by-one-second errors), unless the <tt>with_usec</tt> argument
123
+ # is set to <tt>true</tt>.
119
124
  #
120
125
  # This method also accepts a block, which will return the current time back to its original
121
126
  # state at the end of the block:
@@ -125,7 +130,7 @@ module ActiveSupport
125
130
  # Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
126
131
  # end
127
132
  # Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
128
- def travel_to(date_or_time)
133
+ def travel_to(date_or_time, with_usec: false)
129
134
  if block_given? && in_block
130
135
  travel_to_nested_block_call = <<~MSG
131
136
 
@@ -158,14 +163,27 @@ module ActiveSupport
158
163
  now = date_or_time.midnight.to_time
159
164
  elsif date_or_time.is_a?(String)
160
165
  now = Time.zone.parse(date_or_time)
166
+ elsif with_usec
167
+ now = date_or_time.to_time
161
168
  else
162
169
  now = date_or_time.to_time.change(usec: 0)
163
170
  end
164
171
 
165
- stubbed_time = Time.now if simple_stubs.stubbing(Time, :now)
166
- simple_stubs.stub_object(Time, :now) { at(now.to_i) }
167
- simple_stubs.stub_object(Date, :today) { jd(now.to_date.jd) }
168
- simple_stubs.stub_object(DateTime, :now) { jd(now.to_date.jd, now.hour, now.min, now.sec, Rational(now.utc_offset, 86400)) }
172
+ stubs = simple_stubs
173
+ stubbed_time = Time.now if stubs.stubbing(Time, :now)
174
+ stubs.stub_object(Time, :now) { at(now) }
175
+
176
+ stubs.stub_object(Time, :new) do |*args, **options|
177
+ if args.empty? && options.empty?
178
+ at(now)
179
+ else
180
+ stub = stubs.stubbing(Time, :new)
181
+ Time.send(stub.original_method, *args, **options)
182
+ end
183
+ end
184
+
185
+ stubs.stub_object(Date, :today) { jd(now.to_date.jd) }
186
+ stubs.stub_object(DateTime, :now) { jd(now.to_date.jd, now.hour, now.min, now.sec, Rational(now.utc_offset, 86400)) }
169
187
 
170
188
  if block_given?
171
189
  begin
@@ -215,7 +233,7 @@ module ActiveSupport
215
233
  end
216
234
  alias_method :unfreeze_time, :travel_back
217
235
 
218
- # Calls +travel_to+ with +Time.now+.
236
+ # Calls +travel_to+ with +Time.now+. Forwards optional <tt>with_usec</tt> argument.
219
237
  #
220
238
  # Time.current # => Sun, 09 Jul 2017 15:34:49 EST -05:00
221
239
  # freeze_time
@@ -231,8 +249,8 @@ module ActiveSupport
231
249
  # User.create.created_at # => Sun, 09 Jul 2017 15:34:49 EST -05:00
232
250
  # end
233
251
  # Time.current # => Sun, 09 Jul 2017 15:34:50 EST -05:00
234
- def freeze_time(&block)
235
- travel_to Time.now, &block
252
+ def freeze_time(with_usec: false, &block)
253
+ travel_to Time.now, with_usec: with_usec, &block
236
254
  end
237
255
 
238
256
  private
@@ -8,6 +8,8 @@ require "active_support/core_ext/object/acts_like"
8
8
  require "active_support/core_ext/date_and_time/compatibility"
9
9
 
10
10
  module ActiveSupport
11
+ # = Active Support \Time With Zone
12
+ #
11
13
  # A Time-like class that can represent a time in any time zone. Necessary
12
14
  # because standard Ruby Time instances are limited to UTC and the
13
15
  # system's <tt>ENV['TZ']</tt> zone.
@@ -40,18 +42,6 @@ module ActiveSupport
40
42
  # t.is_a?(Time) # => true
41
43
  # t.is_a?(ActiveSupport::TimeWithZone) # => true
42
44
  class TimeWithZone
43
- # Report class name as 'Time' to thwart type checking.
44
- def self.name
45
- ActiveSupport::Deprecation.warn(<<~EOM)
46
- ActiveSupport::TimeWithZone.name has been deprecated and
47
- from Rails 7.1 will use the default Ruby implementation.
48
- You can set `config.active_support.remove_deprecated_time_with_zone_name = true`
49
- to enable the new behavior now.
50
- EOM
51
-
52
- "Time"
53
- end
54
-
55
45
  PRECISIONS = Hash.new { |h, n| h[n] = "%FT%T.%#{n}N" }
56
46
  PRECISIONS[0] = "%FT%T"
57
47
 
@@ -78,7 +68,7 @@ module ActiveSupport
78
68
  alias_method :getutc, :utc
79
69
  alias_method :gmtime, :utc
80
70
 
81
- # Returns the underlying <tt>TZInfo::TimezonePeriod</tt>.
71
+ # Returns the underlying +TZInfo::TimezonePeriod+.
82
72
  def period
83
73
  @period ||= time_zone.period_for_utc(@utc)
84
74
  end
@@ -218,7 +208,7 @@ module ActiveSupport
218
208
  # Accepts an optional <tt>format</tt>:
219
209
  # * <tt>:default</tt> - default value, mimics Ruby Time#to_s format.
220
210
  # * <tt>:db</tt> - format outputs time in UTC :db time. See Time#to_fs(:db).
221
- # * Any key in <tt>Time::DATE_FORMATS</tt> can be used. See active_support/core_ext/time/conversions.rb.
211
+ # * Any key in +Time::DATE_FORMATS+ can be used. See active_support/core_ext/time/conversions.rb.
222
212
  def to_fs(format = :default)
223
213
  if format == :db
224
214
  utc.to_fs(format)
@@ -4,18 +4,20 @@ require "tzinfo"
4
4
  require "concurrent/map"
5
5
 
6
6
  module ActiveSupport
7
- # The TimeZone class serves as a wrapper around <tt>TZInfo::Timezone</tt> instances.
7
+ # = Active Support \Time Zone
8
+ #
9
+ # The TimeZone class serves as a wrapper around +TZInfo::Timezone+ instances.
8
10
  # It allows us to do the following:
9
11
  #
10
12
  # * Limit the set of zones provided by TZInfo to a meaningful subset of 134
11
13
  # zones.
12
14
  # * Retrieve and display zones with a friendlier name
13
15
  # (e.g., "Eastern Time (US & Canada)" instead of "America/New_York").
14
- # * Lazily load <tt>TZInfo::Timezone</tt> instances only when they're needed.
16
+ # * Lazily load +TZInfo::Timezone+ instances only when they're needed.
15
17
  # * Create ActiveSupport::TimeWithZone instances via TimeZone's +local+,
16
18
  # +parse+, +at+, and +now+ methods.
17
19
  #
18
- # If you set <tt>config.time_zone</tt> in the Rails Application, you can
20
+ # If you set <tt>config.time_zone</tt> in the \Rails Application, you can
19
21
  # access this TimeZone object via <tt>Time.zone</tt>:
20
22
  #
21
23
  # # application.rb:
@@ -27,7 +29,7 @@ module ActiveSupport
27
29
  # Time.zone.name # => "Eastern Time (US & Canada)"
28
30
  # Time.zone.now # => Sun, 18 May 2008 14:30:44 EDT -04:00
29
31
  class TimeZone
30
- # Keys are Rails TimeZone names, values are TZInfo identifiers.
32
+ # Keys are \Rails TimeZone names, values are TZInfo identifiers.
31
33
  MAPPING = {
32
34
  "International Date Line West" => "Etc/GMT+12",
33
35
  "Midway Island" => "Pacific/Midway",
@@ -159,7 +161,7 @@ module ActiveSupport
159
161
  "Yakutsk" => "Asia/Yakutsk",
160
162
  "Darwin" => "Australia/Darwin",
161
163
  "Adelaide" => "Australia/Adelaide",
162
- "Canberra" => "Australia/Melbourne",
164
+ "Canberra" => "Australia/Canberra",
163
165
  "Melbourne" => "Australia/Melbourne",
164
166
  "Sydney" => "Australia/Sydney",
165
167
  "Brisbane" => "Australia/Brisbane",
@@ -543,13 +545,13 @@ module ActiveSupport
543
545
  tzinfo.local_to_utc(time, dst)
544
546
  end
545
547
 
546
- # Available so that TimeZone instances respond like <tt>TZInfo::Timezone</tt>
548
+ # Available so that TimeZone instances respond like +TZInfo::Timezone+
547
549
  # instances.
548
550
  def period_for_utc(time)
549
551
  tzinfo.period_for_utc(time)
550
552
  end
551
553
 
552
- # Available so that TimeZone instances respond like <tt>TZInfo::Timezone</tt>
554
+ # Available so that TimeZone instances respond like +TZInfo::Timezone+
553
555
  # instances.
554
556
  def period_for_local(time, dst = true)
555
557
  tzinfo.period_for_local(time, dst) { |periods| periods.last }
@@ -3,7 +3,7 @@
3
3
  require_relative "gem_version"
4
4
 
5
5
  module ActiveSupport
6
- # Returns the currently loaded version of Active Support as a <tt>Gem::Version</tt>.
6
+ # Returns the currently loaded version of Active Support as a +Gem::Version+.
7
7
  def self.version
8
8
  gem_version
9
9
  end
@@ -20,13 +20,6 @@ module ActiveSupport
20
20
 
21
21
  CONTENT_KEY = "__content__"
22
22
 
23
- NODE_TYPE_NAMES = %w{ATTRIBUTE_NODE CDATA_SECTION_NODE COMMENT_NODE DOCUMENT_FRAGMENT_NODE
24
- DOCUMENT_NODE DOCUMENT_TYPE_NODE ELEMENT_NODE ENTITY_NODE ENTITY_REFERENCE_NODE NOTATION_NODE
25
- PROCESSING_INSTRUCTION_NODE TEXT_NODE}
26
-
27
- node_type_map = {}
28
- NODE_TYPE_NAMES.each { |type| node_type_map[Node.send(type)] = type }
29
-
30
23
  # Parse an XML Document string or IO into a simple hash using Java's jdom.
31
24
  # data::
32
25
  # XML Document string or IO to parse
@@ -80,7 +73,7 @@ module ActiveSupport
80
73
  if child_nodes.length > 0
81
74
  (0...child_nodes.length).each do |i|
82
75
  child = child_nodes.item(i)
83
- merge_element!(hash, child, depth - 1) unless child.node_type == Node.TEXT_NODE
76
+ merge_element!(hash, child, depth - 1) unless child.node_type == Node::TEXT_NODE
84
77
  end
85
78
  merge_texts!(hash, element) unless empty_content?(element)
86
79
  hash
@@ -156,7 +149,7 @@ module ActiveSupport
156
149
  child_nodes = element.child_nodes
157
150
  (0...child_nodes.length).each do |i|
158
151
  item = child_nodes.item(i)
159
- if item.node_type == Node.TEXT_NODE
152
+ if item.node_type == Node::TEXT_NODE
160
153
  texts << item.get_data
161
154
  end
162
155
  end
@@ -172,7 +165,7 @@ module ActiveSupport
172
165
  child_nodes = element.child_nodes
173
166
  (0...child_nodes.length).each do |i|
174
167
  item = child_nodes.item(i)
175
- if item.node_type == Node.TEXT_NODE
168
+ if item.node_type == Node::TEXT_NODE
176
169
  text << item.get_data.strip
177
170
  end
178
171
  end
@@ -3,7 +3,7 @@
3
3
  begin
4
4
  require "nokogiri"
5
5
  rescue LoadError => e
6
- $stderr.puts "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install"
6
+ warn "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install"
7
7
  raise e
8
8
  end
9
9
  require "active_support/core_ext/object/blank"
@@ -3,7 +3,7 @@
3
3
  begin
4
4
  require "nokogiri"
5
5
  rescue LoadError => e
6
- $stderr.puts "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install"
6
+ warn "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install"
7
7
  raise e
8
8
  end
9
9
  require "active_support/core_ext/object/blank"
@@ -41,7 +41,7 @@ module ActiveSupport
41
41
  def require_rexml
42
42
  silence_warnings { require "rexml/document" }
43
43
  rescue LoadError => e
44
- $stderr.puts "You don't have rexml installed in your application. Please add it to your Gemfile and run bundle install"
44
+ warn "You don't have rexml installed in your application. Please add it to your Gemfile and run bundle install"
45
45
  raise e
46
46
  end
47
47
 
@@ -9,10 +9,10 @@ require "active_support/core_ext/string/inflections"
9
9
  require "active_support/core_ext/date_time/calculations"
10
10
 
11
11
  module ActiveSupport
12
- # = XmlMini
12
+ # = \XmlMini
13
13
  #
14
14
  # To use the much faster libxml parser:
15
- # gem 'libxml-ruby', '=0.9.7'
15
+ # gem 'libxml-ruby'
16
16
  # XmlMini.backend = 'LibXML'
17
17
  module XmlMini
18
18
  extend self
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  #--
4
- # Copyright (c) 2005-2022 David Heinemeier Hansson
4
+ # Copyright (c) David Heinemeier Hansson
5
5
  #
6
6
  # Permission is hereby granted, free of charge, to any person obtaining
7
7
  # a copy of this software and associated documentation files (the
@@ -26,10 +26,12 @@
26
26
  require "securerandom"
27
27
  require "active_support/dependencies/autoload"
28
28
  require "active_support/version"
29
+ require "active_support/deprecator"
29
30
  require "active_support/logger"
30
31
  require "active_support/lazy_load_hooks"
31
32
  require "active_support/core_ext/date_and_time/compatibility"
32
33
 
34
+ # :include: activesupport/README.rdoc
33
35
  module ActiveSupport
34
36
  extend ActiveSupport::Autoload
35
37
 
@@ -40,7 +42,6 @@ module ActiveSupport
40
42
  autoload :CurrentAttributes
41
43
  autoload :Dependencies
42
44
  autoload :DescendantsTracker
43
- autoload :ExecutionContext
44
45
  autoload :ExecutionWrapper
45
46
  autoload :Executor
46
47
  autoload :ErrorReporter
@@ -51,7 +52,6 @@ module ActiveSupport
51
52
  autoload :IsolatedExecutionState
52
53
  autoload :Notifications
53
54
  autoload :Reloader
54
- autoload :PerThreadRegistry
55
55
  autoload :SecureCompareRotator
56
56
 
57
57
  eager_autoload do
@@ -63,12 +63,15 @@ module ActiveSupport
63
63
  autoload :Configurable
64
64
  autoload :Deprecation
65
65
  autoload :Digest
66
+ autoload :ExecutionContext
66
67
  autoload :Gzip
67
68
  autoload :Inflector
68
69
  autoload :JSON
69
70
  autoload :KeyGenerator
70
71
  autoload :MessageEncryptor
72
+ autoload :MessageEncryptors
71
73
  autoload :MessageVerifier
74
+ autoload :MessageVerifiers
72
75
  autoload :Multibyte
73
76
  autoload :NumberHelper
74
77
  autoload :OptionMerger
@@ -94,6 +97,7 @@ module ActiveSupport
94
97
  cattr_accessor :test_order # :nodoc:
95
98
  cattr_accessor :test_parallelization_threshold, default: 50 # :nodoc:
96
99
 
100
+ @error_reporter = ActiveSupport::ErrorReporter.new
97
101
  singleton_class.attr_accessor :error_reporter # :nodoc:
98
102
 
99
103
  def self.cache_format_version
@@ -109,6 +113,12 @@ module ActiveSupport
109
113
  end
110
114
 
111
115
  def self.to_time_preserves_timezone=(value)
116
+ unless value
117
+ ActiveSupport.deprecator.warn(
118
+ "Support for the pre-Ruby 2.4 behavior of to_time has been deprecated and will be removed in Rails 7.2."
119
+ )
120
+ end
121
+
112
122
  DateAndTime::Compatibility.preserve_timezone = value
113
123
  end
114
124
 
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.0.8.4
4
+ version: 7.1.0.beta1
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-06-04 00:00:00.000000000 Z
11
+ date: 2023-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -64,6 +64,20 @@ dependencies:
64
64
  - - ">="
65
65
  - !ruby/object:Gem::Version
66
66
  version: 1.0.2
67
+ - !ruby/object:Gem::Dependency
68
+ name: connection_pool
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 2.2.5
74
+ type: :runtime
75
+ prerelease: false
76
+ version_requirements: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 2.2.5
67
81
  - !ruby/object:Gem::Dependency
68
82
  name: minitest
69
83
  requirement: !ruby/object:Gem::Requirement
@@ -78,6 +92,62 @@ dependencies:
78
92
  - - ">="
79
93
  - !ruby/object:Gem::Version
80
94
  version: '5.1'
95
+ - !ruby/object:Gem::Dependency
96
+ name: base64
97
+ requirement: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ - !ruby/object:Gem::Dependency
110
+ name: drb
111
+ requirement: !ruby/object:Gem::Requirement
112
+ requirements:
113
+ - - ">="
114
+ - !ruby/object:Gem::Version
115
+ version: '0'
116
+ type: :runtime
117
+ prerelease: false
118
+ version_requirements: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ - !ruby/object:Gem::Dependency
124
+ name: mutex_m
125
+ requirement: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ type: :runtime
131
+ prerelease: false
132
+ version_requirements: !ruby/object:Gem::Requirement
133
+ requirements:
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ - !ruby/object:Gem::Dependency
138
+ name: bigdecimal
139
+ requirement: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ type: :runtime
145
+ prerelease: false
146
+ version_requirements: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
81
151
  description: A toolkit of support libraries and Ruby core extensions extracted from
82
152
  the Rails framework. Rich support for multibyte strings, internationalization, time
83
153
  zones, and testing.
@@ -97,17 +167,21 @@ files:
97
167
  - lib/active_support/benchmarkable.rb
98
168
  - lib/active_support/builder.rb
99
169
  - lib/active_support/cache.rb
170
+ - lib/active_support/cache/coder.rb
171
+ - lib/active_support/cache/entry.rb
100
172
  - lib/active_support/cache/file_store.rb
101
173
  - lib/active_support/cache/mem_cache_store.rb
102
174
  - lib/active_support/cache/memory_store.rb
103
175
  - lib/active_support/cache/null_store.rb
104
176
  - lib/active_support/cache/redis_cache_store.rb
177
+ - lib/active_support/cache/serializer_with_fallback.rb
105
178
  - lib/active_support/cache/strategy/local_cache.rb
106
179
  - lib/active_support/cache/strategy/local_cache_middleware.rb
107
180
  - lib/active_support/callbacks.rb
108
181
  - lib/active_support/code_generator.rb
109
182
  - lib/active_support/concern.rb
110
183
  - lib/active_support/concurrency/load_interlock_aware_monitor.rb
184
+ - lib/active_support/concurrency/null_lock.rb
111
185
  - lib/active_support/concurrency/share_lock.rb
112
186
  - lib/active_support/configurable.rb
113
187
  - lib/active_support/configuration_file.rb
@@ -115,7 +189,6 @@ files:
115
189
  - lib/active_support/core_ext/array.rb
116
190
  - lib/active_support/core_ext/array/access.rb
117
191
  - lib/active_support/core_ext/array/conversions.rb
118
- - lib/active_support/core_ext/array/deprecated_conversions.rb
119
192
  - lib/active_support/core_ext/array/extract.rb
120
193
  - lib/active_support/core_ext/array/extract_options.rb
121
194
  - lib/active_support/core_ext/array/grouping.rb
@@ -133,7 +206,6 @@ files:
133
206
  - lib/active_support/core_ext/date/blank.rb
134
207
  - lib/active_support/core_ext/date/calculations.rb
135
208
  - lib/active_support/core_ext/date/conversions.rb
136
- - lib/active_support/core_ext/date/deprecated_conversions.rb
137
209
  - lib/active_support/core_ext/date/zones.rb
138
210
  - lib/active_support/core_ext/date_and_time/calculations.rb
139
211
  - lib/active_support/core_ext/date_and_time/compatibility.rb
@@ -144,10 +216,10 @@ files:
144
216
  - lib/active_support/core_ext/date_time/calculations.rb
145
217
  - lib/active_support/core_ext/date_time/compatibility.rb
146
218
  - lib/active_support/core_ext/date_time/conversions.rb
147
- - lib/active_support/core_ext/date_time/deprecated_conversions.rb
148
219
  - lib/active_support/core_ext/digest.rb
149
220
  - lib/active_support/core_ext/digest/uuid.rb
150
221
  - lib/active_support/core_ext/enumerable.rb
222
+ - lib/active_support/core_ext/erb/util.rb
151
223
  - lib/active_support/core_ext/file.rb
152
224
  - lib/active_support/core_ext/file/atomic.rb
153
225
  - lib/active_support/core_ext/hash.rb
@@ -184,7 +256,6 @@ files:
184
256
  - lib/active_support/core_ext/numeric.rb
185
257
  - lib/active_support/core_ext/numeric/bytes.rb
186
258
  - lib/active_support/core_ext/numeric/conversions.rb
187
- - lib/active_support/core_ext/numeric/deprecated_conversions.rb
188
259
  - lib/active_support/core_ext/numeric/time.rb
189
260
  - lib/active_support/core_ext/object.rb
190
261
  - lib/active_support/core_ext/object/acts_like.rb
@@ -198,16 +269,16 @@ files:
198
269
  - lib/active_support/core_ext/object/to_param.rb
199
270
  - lib/active_support/core_ext/object/to_query.rb
200
271
  - lib/active_support/core_ext/object/try.rb
272
+ - lib/active_support/core_ext/object/with.rb
201
273
  - lib/active_support/core_ext/object/with_options.rb
202
274
  - lib/active_support/core_ext/pathname.rb
275
+ - lib/active_support/core_ext/pathname/blank.rb
203
276
  - lib/active_support/core_ext/pathname/existence.rb
204
277
  - lib/active_support/core_ext/range.rb
205
278
  - lib/active_support/core_ext/range/compare_range.rb
206
279
  - lib/active_support/core_ext/range/conversions.rb
207
- - lib/active_support/core_ext/range/deprecated_conversions.rb
208
280
  - lib/active_support/core_ext/range/each.rb
209
- - lib/active_support/core_ext/range/include_time_with_zone.rb
210
- - lib/active_support/core_ext/range/overlaps.rb
281
+ - lib/active_support/core_ext/range/overlap.rb
211
282
  - lib/active_support/core_ext/regexp.rb
212
283
  - lib/active_support/core_ext/securerandom.rb
213
284
  - lib/active_support/core_ext/string.rb
@@ -226,14 +297,13 @@ files:
226
297
  - lib/active_support/core_ext/string/zones.rb
227
298
  - lib/active_support/core_ext/symbol.rb
228
299
  - lib/active_support/core_ext/symbol/starts_ends_with.rb
300
+ - lib/active_support/core_ext/thread/backtrace/location.rb
229
301
  - lib/active_support/core_ext/time.rb
230
302
  - lib/active_support/core_ext/time/acts_like.rb
231
303
  - lib/active_support/core_ext/time/calculations.rb
232
304
  - lib/active_support/core_ext/time/compatibility.rb
233
305
  - lib/active_support/core_ext/time/conversions.rb
234
- - lib/active_support/core_ext/time/deprecated_conversions.rb
235
306
  - lib/active_support/core_ext/time/zones.rb
236
- - lib/active_support/core_ext/uri.rb
237
307
  - lib/active_support/current_attributes.rb
238
308
  - lib/active_support/current_attributes/test_helper.rb
239
309
  - lib/active_support/dependencies.rb
@@ -243,11 +313,13 @@ files:
243
313
  - lib/active_support/deprecation.rb
244
314
  - lib/active_support/deprecation/behaviors.rb
245
315
  - lib/active_support/deprecation/constant_accessor.rb
316
+ - lib/active_support/deprecation/deprecators.rb
246
317
  - lib/active_support/deprecation/disallowed.rb
247
318
  - lib/active_support/deprecation/instance_delegator.rb
248
319
  - lib/active_support/deprecation/method_wrappers.rb
249
320
  - lib/active_support/deprecation/proxy_wrappers.rb
250
321
  - lib/active_support/deprecation/reporting.rb
322
+ - lib/active_support/deprecator.rb
251
323
  - lib/active_support/descendants_tracker.rb
252
324
  - lib/active_support/digest.rb
253
325
  - lib/active_support/duration.rb
@@ -257,6 +329,7 @@ files:
257
329
  - lib/active_support/encrypted_file.rb
258
330
  - lib/active_support/environment_inquirer.rb
259
331
  - lib/active_support/error_reporter.rb
332
+ - lib/active_support/error_reporter/test_helper.rb
260
333
  - lib/active_support/evented_file_update_checker.rb
261
334
  - lib/active_support/execution_context.rb
262
335
  - lib/active_support/execution_context/test_helper.rb
@@ -290,10 +363,19 @@ files:
290
363
  - lib/active_support/logger_silence.rb
291
364
  - lib/active_support/logger_thread_safe_level.rb
292
365
  - lib/active_support/message_encryptor.rb
366
+ - lib/active_support/message_encryptors.rb
367
+ - lib/active_support/message_pack.rb
368
+ - lib/active_support/message_pack/cache_serializer.rb
369
+ - lib/active_support/message_pack/extensions.rb
370
+ - lib/active_support/message_pack/serializer.rb
293
371
  - lib/active_support/message_verifier.rb
372
+ - lib/active_support/message_verifiers.rb
373
+ - lib/active_support/messages/codec.rb
294
374
  - lib/active_support/messages/metadata.rb
295
375
  - lib/active_support/messages/rotation_configuration.rb
376
+ - lib/active_support/messages/rotation_coordinator.rb
296
377
  - lib/active_support/messages/rotator.rb
378
+ - lib/active_support/messages/serializer_with_fallback.rb
297
379
  - lib/active_support/multibyte.rb
298
380
  - lib/active_support/multibyte/chars.rb
299
381
  - lib/active_support/multibyte/unicode.rb
@@ -314,7 +396,6 @@ files:
314
396
  - lib/active_support/ordered_hash.rb
315
397
  - lib/active_support/ordered_options.rb
316
398
  - lib/active_support/parameter_filter.rb
317
- - lib/active_support/per_thread_registry.rb
318
399
  - lib/active_support/proxy_object.rb
319
400
  - lib/active_support/rails.rb
320
401
  - lib/active_support/railtie.rb
@@ -325,13 +406,16 @@ files:
325
406
  - lib/active_support/security_utils.rb
326
407
  - lib/active_support/string_inquirer.rb
327
408
  - lib/active_support/subscriber.rb
409
+ - lib/active_support/syntax_error_proxy.rb
328
410
  - lib/active_support/tagged_logging.rb
329
411
  - lib/active_support/test_case.rb
330
412
  - lib/active_support/testing/assertions.rb
331
413
  - lib/active_support/testing/autorun.rb
332
414
  - lib/active_support/testing/constant_lookup.rb
415
+ - lib/active_support/testing/constant_stubbing.rb
333
416
  - lib/active_support/testing/declarative.rb
334
417
  - lib/active_support/testing/deprecation.rb
418
+ - lib/active_support/testing/error_reporter_assertions.rb
335
419
  - lib/active_support/testing/file_fixtures.rb
336
420
  - lib/active_support/testing/isolation.rb
337
421
  - lib/active_support/testing/method_call_assertions.rb
@@ -341,6 +425,7 @@ files:
341
425
  - lib/active_support/testing/parallelize_executor.rb
342
426
  - lib/active_support/testing/setup_and_teardown.rb
343
427
  - lib/active_support/testing/stream.rb
428
+ - lib/active_support/testing/strict_warnings.rb
344
429
  - lib/active_support/testing/tagged_logging.rb
345
430
  - lib/active_support/testing/time_helpers.rb
346
431
  - lib/active_support/time.rb
@@ -359,10 +444,10 @@ licenses:
359
444
  - MIT
360
445
  metadata:
361
446
  bug_tracker_uri: https://github.com/rails/rails/issues
362
- changelog_uri: https://github.com/rails/rails/blob/v7.0.8.4/activesupport/CHANGELOG.md
363
- documentation_uri: https://api.rubyonrails.org/v7.0.8.4/
447
+ changelog_uri: https://github.com/rails/rails/blob/v7.1.0.beta1/activesupport/CHANGELOG.md
448
+ documentation_uri: https://api.rubyonrails.org/v7.1.0.beta1/
364
449
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
365
- source_code_uri: https://github.com/rails/rails/tree/v7.0.8.4/activesupport
450
+ source_code_uri: https://github.com/rails/rails/tree/v7.1.0.beta1/activesupport
366
451
  rubygems_mfa_required: 'true'
367
452
  post_install_message:
368
453
  rdoc_options:
@@ -377,11 +462,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
377
462
  version: 2.7.0
378
463
  required_rubygems_version: !ruby/object:Gem::Requirement
379
464
  requirements:
380
- - - ">="
465
+ - - ">"
381
466
  - !ruby/object:Gem::Version
382
- version: '0'
467
+ version: 1.3.1
383
468
  requirements: []
384
- rubygems_version: 3.3.27
469
+ rubygems_version: 3.4.18
385
470
  signing_key:
386
471
  specification_version: 4
387
472
  summary: A toolkit of support libraries and Ruby core extensions extracted from the