activesupport 7.2.3 → 8.0.1

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 (78) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +72 -347
  3. data/README.rdoc +1 -1
  4. data/lib/active_support/backtrace_cleaner.rb +2 -2
  5. data/lib/active_support/benchmark.rb +21 -0
  6. data/lib/active_support/benchmarkable.rb +3 -2
  7. data/lib/active_support/broadcast_logger.rb +74 -61
  8. data/lib/active_support/cache/file_store.rb +14 -4
  9. data/lib/active_support/cache/mem_cache_store.rb +15 -13
  10. data/lib/active_support/cache/memory_store.rb +9 -5
  11. data/lib/active_support/cache/null_store.rb +2 -2
  12. data/lib/active_support/cache/redis_cache_store.rb +6 -3
  13. data/lib/active_support/cache/strategy/local_cache.rb +20 -56
  14. data/lib/active_support/cache.rb +19 -14
  15. data/lib/active_support/callbacks.rb +7 -6
  16. data/lib/active_support/class_attribute.rb +33 -0
  17. data/lib/active_support/code_generator.rb +9 -0
  18. data/lib/active_support/concurrency/share_lock.rb +0 -1
  19. data/lib/active_support/configuration_file.rb +15 -6
  20. data/lib/active_support/core_ext/array/conversions.rb +3 -3
  21. data/lib/active_support/core_ext/benchmark.rb +6 -10
  22. data/lib/active_support/core_ext/class/attribute.rb +22 -18
  23. data/lib/active_support/core_ext/date/conversions.rb +2 -0
  24. data/lib/active_support/core_ext/date_and_time/compatibility.rb +2 -2
  25. data/lib/active_support/core_ext/date_time/conversions.rb +2 -4
  26. data/lib/active_support/core_ext/enumerable.rb +13 -20
  27. data/lib/active_support/core_ext/hash/except.rb +0 -12
  28. data/lib/active_support/core_ext/module/attr_internal.rb +3 -4
  29. data/lib/active_support/core_ext/module/introspection.rb +0 -3
  30. data/lib/active_support/core_ext/object/json.rb +15 -9
  31. data/lib/active_support/core_ext/object/try.rb +2 -2
  32. data/lib/active_support/core_ext/range.rb +0 -1
  33. data/lib/active_support/core_ext/string/filters.rb +3 -3
  34. data/lib/active_support/core_ext/string/multibyte.rb +2 -2
  35. data/lib/active_support/core_ext/thread/backtrace/location.rb +2 -7
  36. data/lib/active_support/core_ext/time/calculations.rb +14 -2
  37. data/lib/active_support/core_ext/time/conversions.rb +2 -0
  38. data/lib/active_support/current_attributes.rb +7 -14
  39. data/lib/active_support/delegation.rb +0 -2
  40. data/lib/active_support/dependencies.rb +0 -1
  41. data/lib/active_support/deprecation/reporting.rb +0 -19
  42. data/lib/active_support/deprecation.rb +1 -1
  43. data/lib/active_support/duration.rb +14 -10
  44. data/lib/active_support/encrypted_configuration.rb +20 -2
  45. data/lib/active_support/error_reporter.rb +27 -6
  46. data/lib/active_support/evented_file_update_checker.rb +0 -1
  47. data/lib/active_support/execution_wrapper.rb +1 -1
  48. data/lib/active_support/file_update_checker.rb +1 -1
  49. data/lib/active_support/gem_version.rb +3 -3
  50. data/lib/active_support/hash_with_indifferent_access.rb +31 -35
  51. data/lib/active_support/i18n_railtie.rb +19 -11
  52. data/lib/active_support/isolated_execution_state.rb +0 -2
  53. data/lib/active_support/json/decoding.rb +1 -1
  54. data/lib/active_support/json/encoding.rb +7 -25
  55. data/lib/active_support/lazy_load_hooks.rb +1 -1
  56. data/lib/active_support/message_encryptors.rb +2 -2
  57. data/lib/active_support/message_verifier.rb +0 -9
  58. data/lib/active_support/message_verifiers.rb +3 -5
  59. data/lib/active_support/messages/rotator.rb +0 -5
  60. data/lib/active_support/multibyte/chars.rb +1 -4
  61. data/lib/active_support/notifications/fanout.rb +0 -1
  62. data/lib/active_support/number_helper.rb +22 -0
  63. data/lib/active_support/railtie.rb +4 -0
  64. data/lib/active_support/tagged_logging.rb +5 -0
  65. data/lib/active_support/testing/assertions.rb +79 -21
  66. data/lib/active_support/testing/isolation.rb +0 -2
  67. data/lib/active_support/testing/parallelization/server.rb +2 -15
  68. data/lib/active_support/testing/parallelization/worker.rb +2 -2
  69. data/lib/active_support/testing/parallelization.rb +1 -12
  70. data/lib/active_support/testing/strict_warnings.rb +43 -0
  71. data/lib/active_support/testing/time_helpers.rb +2 -1
  72. data/lib/active_support/time_with_zone.rb +22 -13
  73. data/lib/active_support/values/time_zone.rb +11 -9
  74. data/lib/active_support/xml_mini.rb +0 -2
  75. data/lib/active_support.rb +10 -3
  76. metadata +27 -9
  77. data/lib/active_support/core_ext/range/sole.rb +0 -17
  78. data/lib/active_support/proxy_object.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d12b3bc49972cf65396ee7cb16b370f76853dde525bf3d111e6da8a5936ab441
4
- data.tar.gz: a97522d2f10dc74dc7d3bc922eb37b3b6c369bd729e26a22e97d250602d6c544
3
+ metadata.gz: e4fc487978c855f357de44a7915c8d6d21161a4731bfe676294c1a39f91083d8
4
+ data.tar.gz: e0c7577dabe5346cdcaddef70cb94d58d636df12bef5f7b96df8c062f1831d08
5
5
  SHA512:
6
- metadata.gz: 2a89e3f270073d83270087ad960f1236ee794fb833303b1e97121a1f52b20f07ca79d22c879b474d33d9180b2fbc90359619bd20886a8ab978dabcd7df3df4e2
7
- data.tar.gz: 0576fb7d4a4bef1d8e9e8a0bbce32f0fbb74ba626e7bbcacabcf50352aaf3c2f6567e4989debe83095164b1f9a16a31ea9c0a9afe55cd4327ffc645f5acbef2d
6
+ metadata.gz: 2fc772fb80613c40405114a4cf7a806fe77766ee128c7c308de18eedd73fa6581f95dd072cdf38b13947d91d9df560620b8126b199577b293f2095c4c6d0481e
7
+ data.tar.gz: 8aa7beb41005f500c9d4d1287f2f11724f7178aaa9953c089d4afb5523060136da33771f3ac0ee5edf8dc91afcb9bd31272eaeef650c9238c670c6f0c82b18cb
data/CHANGELOG.md CHANGED
@@ -1,157 +1,73 @@
1
- ## Rails 7.2.3 (October 28, 2025) ##
1
+ ## Rails 8.0.1 (December 13, 2024) ##
2
2
 
3
- * Fix `Enumerable#sole` to return the full tuple instead of just the first element of the tuple.
4
-
5
- *Olivier Bellone*
6
-
7
- * Fix parallel tests hanging when worker processes die abruptly.
8
-
9
- Previously, if a worker process was killed (e.g., OOM killed, `kill -9`) during parallel
10
- test execution, the test suite would hang forever waiting for the dead worker.
11
-
12
- *Joshua Young*
13
-
14
- * `ActiveSupport::FileUpdateChecker` does not depend on `Time.now` to prevent unnecessary reloads with time travel test helpers
15
-
16
- *Jan Grodowski*
3
+ * Fix a bug in `ERB::Util.tokenize` that causes incorrect tokenization when ERB tags are preceeded by multibyte characters.
17
4
 
18
- * Fix `ActiveSupport::BroadcastLogger` from executing a block argument for each logger (tagged, info, etc.).
5
+ *Martin Emde*
19
6
 
20
- *Jared Armstrong*
7
+ * Restore the ability to decorate methods generated by `class_attribute`.
21
8
 
22
- * Fix `ActiveSupport::HashWithIndifferentAccess#transform_keys!` removing defaults.
9
+ It always has been complicated to use Module#prepend or an alias method chain
10
+ to decorate methods defined by `class_attribute`, but became even harder in 8.0.
23
11
 
24
- *Hartley McGuire*
12
+ This capability is now supported for both reader and writer methods.
25
13
 
26
- * Fix `ActiveSupport::HashWithIndifferentAccess#tranform_keys!` to handle collisions.
14
+ *Jean Boussier*
27
15
 
28
- If the transformation would result in a key equal to another not yet transformed one,
29
- it would result in keys being lost.
30
16
 
31
- Before:
17
+ ## Rails 8.0.0.1 (December 10, 2024) ##
32
18
 
33
- ```ruby
34
- >> {a: 1, b: 2}.with_indifferent_access.transform_keys!(&:succ)
35
- => {"c" => 1}
36
- ```
19
+ * No changes.
37
20
 
38
- After:
39
21
 
40
- ```ruby
41
- >> {a: 1, b: 2}.with_indifferent_access.transform_keys!(&:succ)
42
- => {"c" => 1, "d" => 2}
43
- ```
22
+ ## Rails 8.0.0 (November 07, 2024) ##
44
23
 
45
- *Jason T Johnson*, *Jean Boussier*
24
+ * No changes.
46
25
 
47
- * Fix `ActiveSupport::Cache::MemCacheStore#read_multi` to handle network errors.
48
26
 
49
- This method specifically wasn't handling network errors like other codepaths.
27
+ ## Rails 8.0.0.rc2 (October 30, 2024) ##
50
28
 
51
- *Alessandro Dal Grande*
29
+ * No changes.
52
30
 
53
- * Fix Active Support Cache `fetch_multi` when local store is active.
54
31
 
55
- `fetch_multi` now properly yield to the provided block for missing entries
56
- that have been recorded as such in the local store.
32
+ ## Rails 8.0.0.rc1 (October 19, 2024) ##
57
33
 
58
- *Jean Boussier*
34
+ * Remove deprecated support to passing an array of strings to `ActiveSupport::Deprecation#warn`.
59
35
 
60
- * Fix execution wrapping to report all exceptions, including `Exception`.
36
+ *Rafael Mendonça França*
61
37
 
62
- If a more serious error like `SystemStackError` or `NoMemoryError` happens,
63
- the error reporter should be able to report these kinds of exceptions.
38
+ * Remove deprecated support to setting `attr_internal_naming_format` with a `@` prefix.
64
39
 
65
- *Gannon McGibbon*
40
+ *Rafael Mendonça França*
66
41
 
67
- * Fix `RedisCacheStore` and `MemCacheStore` to also handle connection pool related errors.
42
+ * Remove deprecated `ActiveSupport::ProxyObject`.
68
43
 
69
- These errors are rescued and reported to `Rails.error`.
44
+ *Rafael Mendonça França*
70
45
 
71
- *Jean Boussier*
46
+ * Don't execute i18n watcher on boot. It shouldn't catch any file changes initially,
47
+ and unnecessarily slows down boot of applications with lots of translations.
72
48
 
73
- * Fix `ActiveSupport::Cache#read_multi` to respect version expiry when using local cache.
49
+ *Gannon McGibbon*, *David Stosik*
74
50
 
75
- *zzak*
51
+ * Fix `ActiveSupport::HashWithIndifferentAccess#stringify_keys` to stringify all keys not just symbols.
76
52
 
77
- * Fix `ActiveSupport::MessageVerifier` and `ActiveSupport::MessageEncryptor` configuration of `on_rotation` callback.
53
+ Previously:
78
54
 
79
55
  ```ruby
80
- verifier.rotate(old_secret).on_rotation { ... }
56
+ { 1 => 2 }.with_indifferent_access.stringify_keys[1] # => 2
81
57
  ```
82
58
 
83
- Now both work as documented.
84
-
85
- *Jean Boussier*
86
-
87
- * Fix `ActiveSupport::MessageVerifier` to always be able to verify both URL-safe and URL-unsafe payloads.
88
-
89
- This is to allow transitioning seemlessly from either configuration without immediately invalidating
90
- all previously generated signed messages.
91
-
92
- *Jean Boussier*, *Florent Beaurain*, *Ali Sepehri*
93
-
94
- * Fix `cache.fetch` to honor the provided expiry when `:race_condition_ttl` is used.
59
+ After this change:
95
60
 
96
61
  ```ruby
97
- cache.fetch("key", expires_in: 1.hour, race_condition_ttl: 5.second) do
98
- "something"
99
- end
62
+ { 1 => 2 }.with_indifferent_access.stringify_keys["1"] # => 2
100
63
  ```
101
64
 
102
- In the above example, the final cache entry would have a 10 seconds TTL instead
103
- of the requested 1 hour.
104
-
105
- *Dhia*
106
-
107
- * Better handle procs with splat arguments in `set_callback`.
108
-
109
- *Radamés Roriz*
110
-
111
- * Fix `String#mb_chars` to not mutate the receiver.
112
-
113
- Previously it would call `force_encoding` on the receiver,
114
- now it dups the receiver first.
115
-
116
- *Jean Boussier*
117
-
118
- * Improve `ErrorSubscriber` to also mark error causes as reported.
119
-
120
- This avoid some cases of errors being reported twice, notably in views because of how
121
- errors are wrapped in `ActionView::Template::Error`.
65
+ This change can be seen as a bug fix, but since it behaved like this for a very long time, we're deciding
66
+ to not backport the fix and to make the change in a major release.
122
67
 
123
68
  *Jean Boussier*
124
69
 
125
- * Fix `Module#module_parent_name` to return the correct name after the module has been named.
126
-
127
- When called on an anonymous module, the return value wouldn't change after the module was given a name
128
- later by being assigned to a constant.
129
-
130
- ```ruby
131
- mod = Module.new
132
- mod.module_parent_name # => "Object"
133
- MyModule::Something = mod
134
- mod.module_parent_name # => "MyModule"
135
- ```
136
-
137
- *Jean Boussier*
138
-
139
- * Fix a bug in `ERB::Util.tokenize` that causes incorrect tokenization when ERB tags are preceeded by multibyte characters.
140
-
141
- *Martin Emde*
142
-
143
-
144
- ## Rails 7.2.2.2 (August 13, 2025) ##
145
-
146
- * No changes.
147
-
148
-
149
- ## Rails 7.2.2.1 (December 10, 2024) ##
150
-
151
- * No changes.
152
-
153
-
154
- ## Rails 7.2.2 (October 30, 2024) ##
70
+ ## Rails 8.0.0.beta1 (September 26, 2024) ##
155
71
 
156
72
  * Include options when instrumenting `ActiveSupport::Cache::Store#delete` and `ActiveSupport::Cache::Store#delete_multi`.
157
73
 
@@ -161,272 +77,81 @@
161
77
 
162
78
  *John Hawthorn*, *Abeid Ahmed*
163
79
 
80
+ * Deprecate `Benchmark.ms` core extension.
164
81
 
165
- ## Rails 7.2.1.2 (October 23, 2024) ##
166
-
167
- * No changes.
168
-
169
-
170
- ## Rails 7.2.1.1 (October 15, 2024) ##
171
-
172
- * No changes.
173
-
174
-
175
- ## Rails 7.2.1 (August 22, 2024) ##
176
-
177
- * No changes.
178
-
179
-
180
- ## Rails 7.2.0 (August 09, 2024) ##
181
-
182
- * Fix `delegate_missing_to allow_nil: true` when called with implict self
183
-
184
- ```ruby
185
- class Person
186
- delegate_missing_to :address, allow_nil: true
187
-
188
- def address
189
- nil
190
- end
191
-
192
- def berliner?
193
- city == "Berlin"
194
- end
195
- end
196
-
197
- Person.new.city # => nil
198
- Person.new.berliner? # undefined local variable or method `city' for an instance of Person (NameError)
199
- ```
200
-
201
- *Jean Boussier*
202
-
203
- * Add `logger` as a dependency since it is a bundled gem candidate for Ruby 3.5
82
+ The `benchmark` gem will become bundled in Ruby 3.5
204
83
 
205
84
  *Earlopain*
206
85
 
207
- * Define `Digest::UUID.nil_uuid`, which returns the so-called nil UUID.
208
-
209
- *Xavier Noria*
210
-
211
- * Support `duration` type in `ActiveSupport::XmlMini`.
86
+ * `ActiveSupport::TimeWithZone#inspect` now uses ISO 8601 style time like `Time#inspect`
212
87
 
213
- *heka1024*
88
+ *John Hawthorn*
214
89
 
215
- * Remove deprecated `ActiveSupport::Notifications::Event#children` and `ActiveSupport::Notifications::Event#parent_of?`.
216
-
217
- *Rafael Mendonça França*
90
+ * `ActiveSupport::ErrorReporter#report` now assigns a backtrace to unraised exceptions.
218
91
 
219
- * Remove deprecated support to call the following methods without passing a deprecator:
220
-
221
- - `deprecate`
222
- - `deprecate_constant`
223
- - `ActiveSupport::Deprecation::DeprecatedObjectProxy.new`
224
- - `ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new`
225
- - `ActiveSupport::Deprecation::DeprecatedConstantProxy.new`
226
- - `assert_deprecated`
227
- - `assert_not_deprecated`
228
- - `collect_deprecations`
229
-
230
- *Rafael Mendonça França*
231
-
232
- * Remove deprecated `ActiveSupport::Deprecation` delegation to instance.
233
-
234
- *Rafael Mendonça França*
235
-
236
- * Remove deprecated `SafeBuffer#clone_empty`.
237
-
238
- *Rafael Mendonça França*
239
-
240
- * Remove deprecated `#to_default_s` from `Array`, `Date`, `DateTime` and `Time`.
241
-
242
- *Rafael Mendonça França*
243
-
244
- * Remove deprecated support to passing `Dalli::Client` instances to `MemCacheStore`.
245
-
246
- *Rafael Mendonça França*
247
-
248
- * Remove deprecated `config.active_support.use_rfc4122_namespaced_uuids`.
249
-
250
- *Rafael Mendonça França*
251
-
252
- * Remove deprecated `config.active_support.remove_deprecated_time_with_zone_name`.
253
-
254
- *Rafael Mendonça França*
255
-
256
- * Remove deprecated `config.active_support.disable_to_s_conversion`.
257
-
258
- *Rafael Mendonça França*
259
-
260
- * Remove deprecated support to bolding log text with positional boolean in `ActiveSupport::LogSubscriber#color`.
261
-
262
- *Rafael Mendonça França*
263
-
264
- * Remove deprecated constants `ActiveSupport::LogSubscriber::CLEAR` and `ActiveSupport::LogSubscriber::BOLD`.
265
-
266
- *Rafael Mendonça França*
267
-
268
- * Remove deprecated support for `config.active_support.cache_format_version = 6.1`.
269
-
270
- *Rafael Mendonça França*
271
-
272
- * Remove deprecated `:pool_size` and `:pool_timeout` options for the cache storage.
273
-
274
- *Rafael Mendonça França*
275
-
276
- * Warn on tests without assertions.
277
-
278
- `ActiveSupport::TestCase` now warns when tests do not run any assertions.
279
- This is helpful in detecting broken tests that do not perform intended assertions.
280
-
281
- *fatkodima*
282
-
283
- * Support `hexBinary` type in `ActiveSupport::XmlMini`.
284
-
285
- *heka1024*
286
-
287
- * Deprecate `ActiveSupport::ProxyObject` in favor of Ruby's built-in `BasicObject`.
288
-
289
- *Earlopain*
290
-
291
- * `stub_const` now accepts a `exists: false` parameter to allow stubbing missing constants.
292
-
293
- *Jean Boussier*
294
-
295
- * Make `ActiveSupport::BacktraceCleaner` copy filters and silencers on dup and clone.
296
-
297
- Previously the copy would still share the internal silencers and filters array,
298
- causing state to leak.
92
+ Previously reporting an un-raised exception would result in an error report without
93
+ a backtrace. Now it automatically generates one.
299
94
 
300
95
  *Jean Boussier*
301
96
 
302
- * Updating Astana with Western Kazakhstan TZInfo identifier.
303
-
304
- *Damian Nelson*
305
-
306
- * Add filename support for `ActiveSupport::Logger.logger_outputs_to?`.
307
-
308
- ```ruby
309
- logger = Logger.new('/var/log/rails.log')
310
- ActiveSupport::Logger.logger_outputs_to?(logger, '/var/log/rails.log')
311
- ```
312
-
313
- *Christian Schmidt*
314
-
315
- * Include `IPAddr#prefix` when serializing an `IPAddr` using the
316
- `ActiveSupport::MessagePack` serializer.
317
-
318
- This change is backward and forward compatible — old payloads can
319
- still be read, and new payloads will be readable by older versions of Rails.
97
+ * Add `escape_html_entities` option to `ActiveSupport::JSON.encode`.
320
98
 
321
- *Taiki Komaba*
322
-
323
- * Add `default:` support for `ActiveSupport::CurrentAttributes.attribute`.
99
+ This allows for overriding the global configuration found at
100
+ `ActiveSupport.escape_html_entities_in_json` for specific calls to `to_json`.
324
101
 
102
+ This should be usable from controllers in the following manner:
325
103
  ```ruby
326
- class Current < ActiveSupport::CurrentAttributes
327
- attribute :counter, default: 0
328
- end
329
- ```
330
-
331
- *Sean Doyle*
332
-
333
- * Yield instance to `Object#with` block.
334
-
335
- ```ruby
336
- client.with(timeout: 5_000) do |c|
337
- c.get("/commits")
338
- end
339
- ```
340
-
341
- *Sean Doyle*
342
-
343
- * Use logical core count instead of physical core count to determine the
344
- default number of workers when parallelizing tests.
345
-
346
- *Jonathan Hefner*
347
-
348
- * Fix `Time.now/DateTime.now/Date.today` to return results in a system timezone after `#travel_to`.
349
-
350
- There is a bug in the current implementation of #travel_to:
351
- it remembers a timezone of its argument, and all stubbed methods start
352
- returning results in that remembered timezone. However, the expected
353
- behavior is to return results in a system timezone.
354
-
355
- *Aleksei Chernenkov*
356
-
357
- * Add `ErrorReported#unexpected` to report precondition violations.
358
-
359
- For example:
360
-
361
- ```ruby
362
- def edit
363
- if published?
364
- Rails.error.unexpected("[BUG] Attempting to edit a published article, that shouldn't be possible")
365
- return false
104
+ class MyController < ApplicationController
105
+ def index
106
+ render json: { hello: "world" }, escape_html_entities: false
366
107
  end
367
- # ...
368
108
  end
369
109
  ```
370
110
 
371
- The above will raise an error in development and test, but only report the error in production.
111
+ *Nigel Baillie*
372
112
 
373
- *Jean Boussier*
374
-
375
- * Make the order of read_multi and write_multi notifications for `Cache::Store#fetch_multi` operations match the order they are executed in.
376
-
377
- *Adam Renberg Tamm*
378
-
379
- * Make return values of `Cache::Store#write` consistent.
113
+ * Raise when using key which can't respond to `#to_sym` in `EncryptedConfiguration`.
380
114
 
381
- The return value was not specified before. Now it returns `true` on a successful write,
382
- `nil` if there was an error talking to the cache backend, and `false` if the write failed
383
- for another reason (e.g. the key already exists and `unless_exist: true` was passed).
115
+ As is the case when trying to use an Integer or Float as a key, which is unsupported.
384
116
 
385
- *Sander Verdonschot*
386
-
387
- * Fix logged cache keys not always matching actual key used by cache action.
388
-
389
- *Hartley McGuire*
390
-
391
- * Improve error messages of `assert_changes` and `assert_no_changes`.
117
+ *zzak*
392
118
 
393
- `assert_changes` error messages now display objects with `.inspect` to make it easier
394
- to differentiate nil from empty strings, strings from symbols, etc.
395
- `assert_no_changes` error messages now surface the actual value.
119
+ * Deprecate addition and since between two `Time` and `ActiveSupport::TimeWithZone`.
396
120
 
397
- *pcreux*
121
+ Previously adding time instances together such as `10.days.ago + 10.days.ago` or `10.days.ago.since(10.days.ago)` produced a nonsensical future date. This behavior is deprecated and will be removed in Rails 8.1.
398
122
 
399
- * Fix `#to_fs(:human_size)` to correctly work with negative numbers.
123
+ *Nick Schwaderer*
400
124
 
401
- *Earlopain*
125
+ * Support rfc2822 format for Time#to_fs & Date#to_fs.
402
126
 
403
- * Fix `BroadcastLogger#dup` so that it duplicates the logger's `broadcasts`.
127
+ *Akshay Birajdar*
404
128
 
405
- *Andrew Novoselac*
129
+ * Optimize load time for `Railtie#initialize_i18n`. Filter `I18n.load_path`s passed to the file watcher to only those
130
+ under `Rails.root`. Previously the watcher would grab all available locales, including those in gems
131
+ which do not require a watcher because they won't change.
406
132
 
407
- * Fix issue where `bootstrap.rb` overwrites the `level` of a `BroadcastLogger`'s `broadcasts`.
133
+ *Nick Schwaderer*
408
134
 
409
- *Andrew Novoselac*
135
+ * Add a `filter` option to `in_order_of` to prioritize certain values in the sorting without filtering the results
136
+ by these values.
410
137
 
411
- * Fix compatibility with the `semantic_logger` gem.
138
+ *Igor Depolli*
412
139
 
413
- The `semantic_logger` gem doesn't behave exactly like stdlib logger in that
414
- `SemanticLogger#level` returns a Symbol while stdlib `Logger#level` returns an Integer.
140
+ * Improve error message when using `assert_difference` or `assert_changes` with a
141
+ proc by printing the proc's source code (MRI only).
415
142
 
416
- This caused the various `LogSubscriber` classes in Rails to break when assigned a
417
- `SemanticLogger` instance.
143
+ *Richard Böhme*, *Jean Boussier*
418
144
 
419
- *Jean Boussier*, *ojab*
145
+ * Add a new configuration value `:zone` for `ActiveSupport.to_time_preserves_timezone` and rename the previous `true` value to `:offset`. The new default value is `:zone`.
420
146
 
421
- * Fix MemoryStore to prevent race conditions when incrementing or decrementing.
147
+ *Jason Kim*, *John Hawthorn*
422
148
 
423
- *Pierre Jambet*
149
+ * Align instrumentation `payload[:key]` in ActiveSupport::Cache to follow the same pattern, with namespaced and normalized keys.
424
150
 
425
- * Implement `HashWithIndifferentAccess#to_proc`.
151
+ *Frederik Erbs Spang Thomsen*
426
152
 
427
- Previously, calling `#to_proc` on `HashWithIndifferentAccess` object used inherited `#to_proc`
428
- method from the `Hash` class, which was not able to access values using indifferent keys.
153
+ * Fix `travel_to` to set usec 0 when `with_usec` is `false` and the given argument String or DateTime.
429
154
 
430
- *fatkodima*
155
+ *mopp*
431
156
 
432
- Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/activesupport/CHANGELOG.md) for previous changes.
157
+ Please check [7-2-stable](https://github.com/rails/rails/blob/7-2-stable/activesupport/CHANGELOG.md) for previous changes.
data/README.rdoc CHANGED
@@ -35,6 +35,6 @@ Bug reports for the Ruby on \Rails project can be filed here:
35
35
 
36
36
  * https://github.com/rails/rails/issues
37
37
 
38
- Feature requests should be discussed on the rubyonrails-core forum here:
38
+ Feature requests should be discussed on the rails-core mailing list here:
39
39
 
40
40
  * https://discuss.rubyonrails.org/c/rubyonrails-core
@@ -18,7 +18,7 @@ module ActiveSupport
18
18
  #
19
19
  # bc = ActiveSupport::BacktraceCleaner.new
20
20
  # root = "#{Rails.root}/"
21
- # bc.add_filter { |line| line.start_with?(root) ? line.from(root.size) : line } # strip the Rails.root prefix
21
+ # bc.add_filter { |line| line.delete_prefix(root) } # strip the Rails.root prefix
22
22
  # bc.add_silencer { |line| /puma|rubygems/.match?(line) } # skip any lines from puma or rubygems
23
23
  # bc.clean(exception.backtrace) # perform the cleanup
24
24
  #
@@ -79,7 +79,7 @@ module ActiveSupport
79
79
  #
80
80
  # # Will turn "/my/rails/root/app/models/person.rb" into "app/models/person.rb"
81
81
  # root = "#{Rails.root}/"
82
- # backtrace_cleaner.add_filter { |line| line.delete_prefix(root) }
82
+ # backtrace_cleaner.add_filter { |line| line.start_with?(root) ? line.from(root.size) : line }
83
83
  def add_filter(&block)
84
84
  @filters << block
85
85
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveSupport
4
+ module Benchmark # :nodoc:
5
+ # Benchmark realtime in the specified time unit. By default,
6
+ # the returned unit is in seconds.
7
+ #
8
+ # ActiveSupport::Benchmark.realtime { sleep 0.1 }
9
+ # # => 0.10007
10
+ #
11
+ # ActiveSupport::Benchmark.realtime(:float_millisecond) { sleep 0.1 }
12
+ # # => 100.07
13
+ #
14
+ # `unit` can be any of the values accepted by Ruby's `Process.clock_gettime`.
15
+ def self.realtime(unit = :float_second, &block)
16
+ time_start = Process.clock_gettime(Process::CLOCK_MONOTONIC, unit)
17
+ yield
18
+ Process.clock_gettime(Process::CLOCK_MONOTONIC, unit) - time_start
19
+ end
20
+ end
21
+ end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "active_support/core_ext/benchmark"
4
3
  require "active_support/core_ext/hash/keys"
5
4
 
6
5
  module ActiveSupport
@@ -41,7 +40,9 @@ module ActiveSupport
41
40
  options[:level] ||= :info
42
41
 
43
42
  result = nil
44
- ms = Benchmark.ms { result = options[:silence] ? logger.silence(&block) : yield }
43
+ ms = ActiveSupport::Benchmark.realtime(:float_millisecond) do
44
+ result = options[:silence] ? logger.silence(&block) : yield
45
+ end
45
46
  logger.public_send(options[:level], "%s (%.1fms)" % [ message, ms ])
46
47
  result
47
48
  else