activesupport 6.0.0 → 6.1.3

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 (152) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +381 -349
  3. data/MIT-LICENSE +1 -1
  4. data/README.rdoc +2 -2
  5. data/lib/active_support.rb +13 -1
  6. data/lib/active_support/array_inquirer.rb +4 -2
  7. data/lib/active_support/backtrace_cleaner.rb +3 -4
  8. data/lib/active_support/benchmarkable.rb +1 -1
  9. data/lib/active_support/cache.rb +101 -59
  10. data/lib/active_support/cache/file_store.rb +11 -11
  11. data/lib/active_support/cache/mem_cache_store.rb +34 -33
  12. data/lib/active_support/cache/memory_store.rb +52 -31
  13. data/lib/active_support/cache/null_store.rb +3 -3
  14. data/lib/active_support/cache/redis_cache_store.rb +38 -33
  15. data/lib/active_support/cache/strategy/local_cache.rb +41 -26
  16. data/lib/active_support/callbacks.rb +65 -59
  17. data/lib/active_support/concern.rb +46 -2
  18. data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +18 -0
  19. data/lib/active_support/concurrency/share_lock.rb +0 -1
  20. data/lib/active_support/configurable.rb +3 -3
  21. data/lib/active_support/configuration_file.rb +46 -0
  22. data/lib/active_support/core_ext.rb +1 -1
  23. data/lib/active_support/core_ext/array/conversions.rb +5 -5
  24. data/lib/active_support/core_ext/benchmark.rb +2 -2
  25. data/lib/active_support/core_ext/class/attribute.rb +34 -44
  26. data/lib/active_support/core_ext/class/subclasses.rb +17 -38
  27. data/lib/active_support/core_ext/date/conversions.rb +2 -1
  28. data/lib/active_support/core_ext/date_and_time/calculations.rb +13 -0
  29. data/lib/active_support/core_ext/date_and_time/compatibility.rb +15 -0
  30. data/lib/active_support/core_ext/date_and_time/zones.rb +0 -1
  31. data/lib/active_support/core_ext/date_time/conversions.rb +0 -1
  32. data/lib/active_support/core_ext/enumerable.rb +76 -4
  33. data/lib/active_support/core_ext/hash/conversions.rb +3 -3
  34. data/lib/active_support/core_ext/hash/deep_transform_values.rb +1 -1
  35. data/lib/active_support/core_ext/hash/except.rb +1 -1
  36. data/lib/active_support/core_ext/hash/keys.rb +1 -1
  37. data/lib/active_support/core_ext/hash/slice.rb +3 -2
  38. data/lib/active_support/core_ext/load_error.rb +1 -1
  39. data/lib/active_support/core_ext/marshal.rb +2 -0
  40. data/lib/active_support/core_ext/module/attr_internal.rb +2 -2
  41. data/lib/active_support/core_ext/module/attribute_accessors.rb +23 -29
  42. data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +8 -4
  43. data/lib/active_support/core_ext/module/concerning.rb +8 -2
  44. data/lib/active_support/core_ext/module/delegation.rb +46 -29
  45. data/lib/active_support/core_ext/module/introspection.rb +2 -25
  46. data/lib/active_support/core_ext/name_error.rb +29 -2
  47. data/lib/active_support/core_ext/numeric/conversions.rb +22 -18
  48. data/lib/active_support/core_ext/object/deep_dup.rb +1 -1
  49. data/lib/active_support/core_ext/object/json.rb +13 -2
  50. data/lib/active_support/core_ext/object/try.rb +4 -2
  51. data/lib/active_support/core_ext/range/compare_range.rb +15 -3
  52. data/lib/active_support/core_ext/range/each.rb +0 -1
  53. data/lib/active_support/core_ext/range/include_time_with_zone.rb +8 -3
  54. data/lib/active_support/core_ext/regexp.rb +8 -1
  55. data/lib/active_support/core_ext/string/access.rb +5 -24
  56. data/lib/active_support/core_ext/string/conversions.rb +1 -0
  57. data/lib/active_support/core_ext/string/inflections.rb +38 -4
  58. data/lib/active_support/core_ext/string/inquiry.rb +1 -0
  59. data/lib/active_support/core_ext/string/multibyte.rb +2 -2
  60. data/lib/active_support/core_ext/string/output_safety.rb +12 -11
  61. data/lib/active_support/core_ext/string/starts_ends_with.rb +2 -2
  62. data/lib/active_support/core_ext/symbol.rb +3 -0
  63. data/lib/active_support/core_ext/symbol/starts_ends_with.rb +14 -0
  64. data/lib/active_support/core_ext/time/calculations.rb +27 -3
  65. data/lib/active_support/core_ext/time/conversions.rb +2 -0
  66. data/lib/active_support/core_ext/uri.rb +5 -1
  67. data/lib/active_support/current_attributes.rb +7 -2
  68. data/lib/active_support/current_attributes/test_helper.rb +13 -0
  69. data/lib/active_support/dependencies.rb +42 -20
  70. data/lib/active_support/dependencies/zeitwerk_integration.rb +9 -2
  71. data/lib/active_support/deprecation.rb +6 -1
  72. data/lib/active_support/deprecation/behaviors.rb +15 -2
  73. data/lib/active_support/deprecation/disallowed.rb +56 -0
  74. data/lib/active_support/deprecation/instance_delegator.rb +0 -1
  75. data/lib/active_support/deprecation/method_wrappers.rb +13 -6
  76. data/lib/active_support/deprecation/proxy_wrappers.rb +6 -2
  77. data/lib/active_support/deprecation/reporting.rb +50 -7
  78. data/lib/active_support/descendants_tracker.rb +6 -3
  79. data/lib/active_support/duration.rb +86 -35
  80. data/lib/active_support/duration/iso8601_parser.rb +0 -1
  81. data/lib/active_support/duration/iso8601_serializer.rb +15 -10
  82. data/lib/active_support/encrypted_file.rb +20 -3
  83. data/lib/active_support/environment_inquirer.rb +20 -0
  84. data/lib/active_support/evented_file_update_checker.rb +69 -134
  85. data/lib/active_support/file_update_checker.rb +0 -1
  86. data/lib/active_support/fork_tracker.rb +62 -0
  87. data/lib/active_support/gem_version.rb +2 -2
  88. data/lib/active_support/hash_with_indifferent_access.rb +43 -24
  89. data/lib/active_support/i18n_railtie.rb +15 -16
  90. data/lib/active_support/inflector/inflections.rb +1 -3
  91. data/lib/active_support/inflector/methods.rb +36 -33
  92. data/lib/active_support/inflector/transliterate.rb +4 -4
  93. data/lib/active_support/json/decoding.rb +4 -5
  94. data/lib/active_support/json/encoding.rb +5 -1
  95. data/lib/active_support/key_generator.rb +1 -1
  96. data/lib/active_support/lazy_load_hooks.rb +0 -1
  97. data/lib/active_support/locale/en.rb +4 -2
  98. data/lib/active_support/locale/en.yml +7 -3
  99. data/lib/active_support/log_subscriber.rb +8 -1
  100. data/lib/active_support/logger.rb +2 -2
  101. data/lib/active_support/logger_silence.rb +2 -26
  102. data/lib/active_support/logger_thread_safe_level.rb +34 -12
  103. data/lib/active_support/message_encryptor.rb +5 -8
  104. data/lib/active_support/message_verifier.rb +7 -7
  105. data/lib/active_support/messages/metadata.rb +11 -2
  106. data/lib/active_support/messages/rotation_configuration.rb +2 -1
  107. data/lib/active_support/messages/rotator.rb +10 -9
  108. data/lib/active_support/multibyte/chars.rb +5 -44
  109. data/lib/active_support/multibyte/unicode.rb +9 -84
  110. data/lib/active_support/notifications.rb +32 -5
  111. data/lib/active_support/notifications/fanout.rb +23 -8
  112. data/lib/active_support/notifications/instrumenter.rb +7 -16
  113. data/lib/active_support/number_helper.rb +33 -14
  114. data/lib/active_support/number_helper/number_converter.rb +5 -6
  115. data/lib/active_support/number_helper/number_to_currency_converter.rb +2 -7
  116. data/lib/active_support/number_helper/number_to_delimited_converter.rb +0 -1
  117. data/lib/active_support/number_helper/number_to_human_converter.rb +1 -2
  118. data/lib/active_support/number_helper/number_to_human_size_converter.rb +1 -2
  119. data/lib/active_support/number_helper/number_to_phone_converter.rb +0 -1
  120. data/lib/active_support/number_helper/number_to_rounded_converter.rb +3 -4
  121. data/lib/active_support/number_helper/rounding_helper.rb +12 -28
  122. data/lib/active_support/option_merger.rb +22 -3
  123. data/lib/active_support/ordered_hash.rb +1 -1
  124. data/lib/active_support/ordered_options.rb +13 -3
  125. data/lib/active_support/parameter_filter.rb +17 -13
  126. data/lib/active_support/per_thread_registry.rb +1 -1
  127. data/lib/active_support/rails.rb +1 -4
  128. data/lib/active_support/railtie.rb +23 -1
  129. data/lib/active_support/rescuable.rb +4 -4
  130. data/lib/active_support/secure_compare_rotator.rb +51 -0
  131. data/lib/active_support/security_utils.rb +19 -12
  132. data/lib/active_support/string_inquirer.rb +4 -3
  133. data/lib/active_support/subscriber.rb +12 -7
  134. data/lib/active_support/tagged_logging.rb +29 -4
  135. data/lib/active_support/testing/assertions.rb +18 -11
  136. data/lib/active_support/testing/parallelization.rb +12 -89
  137. data/lib/active_support/testing/parallelization/server.rb +78 -0
  138. data/lib/active_support/testing/parallelization/worker.rb +100 -0
  139. data/lib/active_support/testing/stream.rb +0 -1
  140. data/lib/active_support/testing/time_helpers.rb +40 -5
  141. data/lib/active_support/time_with_zone.rb +67 -43
  142. data/lib/active_support/values/time_zone.rb +20 -10
  143. data/lib/active_support/xml_mini.rb +0 -1
  144. data/lib/active_support/xml_mini/jdom.rb +0 -1
  145. data/lib/active_support/xml_mini/rexml.rb +8 -1
  146. metadata +39 -38
  147. data/lib/active_support/core_ext/array/prepend_and_append.rb +0 -5
  148. data/lib/active_support/core_ext/hash/compact.rb +0 -5
  149. data/lib/active_support/core_ext/hash/transform_values.rb +0 -5
  150. data/lib/active_support/core_ext/module/reachable.rb +0 -6
  151. data/lib/active_support/core_ext/numeric/inquiry.rb +0 -5
  152. data/lib/active_support/core_ext/range/include_range.rb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20a0c971abcca4b9dabec6e28ef72c919a6ffaed5e35b29e4c3e2f359e99341b
4
- data.tar.gz: e42089cf6ad412ef2fcf772afd6a8e010944b57fde1833c9d495dfb9c5eb3da5
3
+ metadata.gz: 0fd56b6e7b594d2bb95b107f35ff63359e6c2d20e57d009a23ac27b53bbaf22a
4
+ data.tar.gz: 4f2942e1edf853a4096aa0b305cbe79dc1f7cb4e3757e65937e98e8616d26288
5
5
  SHA512:
6
- metadata.gz: 8ff0c3e5feb9bb0dfcf5e0c95b4fb5bb8c6a30d2e276101c8ec949db9ad0895c397dc33cc1a99ec2636b45b3169a495eb8c852440956d8500d95399548b70948
7
- data.tar.gz: fdf6945ee23e487a9b0403fcac9a7b51551900a6338a4caeb34970656033fd1e62c00eda5d463fb6fc3d0ad880470c7544f2a2108bcc5809520a8436d1bdf360
6
+ metadata.gz: 2e0f1c3e75c7b2cbe2cc418e037200d219c54308ddf5dbacbc4d48f540f7bbf131fe7bb875550e519f292fcdc5617ef08c231bc82fa89a3f5235bee0ce4ee476
7
+ data.tar.gz: 4febcb65ed635c37dc00ff243c22b0328523b9c5ff56feab13efc7c4647de1c4dcdf6c4c24fb7b80e22b57367343bfe2a4f994aab1c612b82a37719110e10f54
data/CHANGELOG.md CHANGED
@@ -1,572 +1,604 @@
1
- ## Rails 6.0.0 (August 16, 2019) ##
1
+ ## Rails 6.1.3 (February 17, 2021) ##
2
2
 
3
- * Let `require_dependency` in `zeitwerk` mode look the autoload paths up for
4
- better backwards compatibility.
3
+ * No changes.
5
4
 
6
- *Xavier Noria*
7
5
 
8
- * Let `require_dependency` in `zeitwerk` mode support arguments that respond
9
- to `to_path` for better backwards compatibility.
6
+ ## Rails 6.1.2.1 (February 10, 2021) ##
10
7
 
11
- *Xavier Noria*
8
+ * No changes.
12
9
 
13
- * Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
14
10
 
15
- Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
16
- to make log level local to Ruby Fibers in addition to Threads.
11
+ ## Rails 6.1.2 (February 09, 2021) ##
17
12
 
18
- Example:
13
+ * `ActiveSupport::Cache::MemCacheStore` now accepts an explicit `nil` for its `addresses` argument.
19
14
 
20
- logger = ActiveSupport::Logger.new(STDOUT)
21
- logger.level = 1
22
- p "Main is debug? #{logger.debug?}"
23
-
24
- Fiber.new {
25
- logger.local_level = 0
26
- p "Thread is debug? #{logger.debug?}"
27
- }.resume
15
+ ```ruby
16
+ config.cache_store = :mem_cache_store, nil
28
17
 
29
- p "Main is debug? #{logger.debug?}"
18
+ # is now equivalent to
30
19
 
31
- Before:
20
+ config.cache_store = :mem_cache_store
32
21
 
33
- Main is debug? false
34
- Thread is debug? true
35
- Main is debug? true
22
+ # and is also equivalent to
36
23
 
37
- After:
24
+ config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
38
25
 
39
- Main is debug? false
40
- Thread is debug? true
41
- Main is debug? false
26
+ # which is the fallback behavior of Dalli
27
+ ```
42
28
 
43
- *Alexander Varnin*
29
+ This helps those migrating from `:dalli_store`, where an explicit `nil` was permitted.
44
30
 
45
- * Do not delegate missing `marshal_dump` and `_dump` methods via the
46
- `delegate_missing_to` extension. This avoids unintentionally adding instance
47
- variables when calling `Marshal.dump(object)`, should the delegation target of
48
- `object` be a method which would otherwise add them. Fixes #36522.
31
+ *Michael Overmeyer*
49
32
 
50
- *Aaron Lipman*
51
33
 
52
- ## Rails 6.0.0.rc2 (July 22, 2019) ##
34
+ ## Rails 6.1.1 (January 07, 2021) ##
53
35
 
54
- * `truncate` would return the original string if it was too short to be truncated
55
- and a frozen string if it were long enough to be truncated. Now truncate will
56
- consistently return an unfrozen string regardless. This behavior is consistent
57
- with `gsub` and `strip`.
36
+ * Change `IPAddr#to_json` to match the behavior of the json gem returning the string representation
37
+ instead of the instance variables of the object.
58
38
 
59
39
  Before:
60
40
 
61
- 'foobar'.truncate(5).frozen?
62
- # => true
63
- 'foobar'.truncate(6).frozen?
64
- # => false
41
+ ```ruby
42
+ IPAddr.new("127.0.0.1").to_json
43
+ # => "{\"addr\":2130706433,\"family\":2,\"mask_addr\":4294967295}"
44
+ ```
65
45
 
66
46
  After:
67
47
 
68
- 'foobar'.truncate(5).frozen?
69
- # => false
70
- 'foobar'.truncate(6).frozen?
71
- # => false
48
+ ```ruby
49
+ IPAddr.new("127.0.0.1").to_json
50
+ # => "\"127.0.0.1\""
51
+ ```
72
52
 
73
- *Jordan Thomas*
74
53
 
54
+ ## Rails 6.1.0 (December 09, 2020) ##
75
55
 
76
- ## Rails 6.0.0.rc1 (April 24, 2019) ##
56
+ * Ensure `MemoryStore` disables compression by default. Reverts behavior of
57
+ `MemoryStore` to its prior rails `5.1` behavior.
77
58
 
78
- * Introduce `ActiveSupport::ActionableError`.
59
+ *Max Gurewitz*
79
60
 
80
- Actionable errors let's you dispatch actions from Rails' error pages. This
81
- can help you save time if you have a clear action for the resolution of
82
- common development errors.
61
+ * Calling `iso8601` on negative durations retains the negative sign on individual
62
+ digits instead of prepending it.
83
63
 
84
- The de-facto example are pending migrations. Every time pending migrations
85
- are found, a middleware raises an error. With actionable errors, you can
86
- run the migrations right from the error page. Other examples include Rails
87
- plugins that need to run a rake task to setup themselves. They can now
88
- raise actionable errors to run the setup straight from the error pages.
64
+ This change is required so we can interoperate with PostgreSQL, which prefers
65
+ negative signs for each component.
89
66
 
90
- Here is how to define an actionable error:
67
+ Compatibility with other iso8601 parsers which support leading negatives as well
68
+ as negatives per component is still retained.
91
69
 
92
- ```ruby
93
- class PendingMigrationError < MigrationError #:nodoc:
94
- include ActiveSupport::ActionableError
70
+ Before:
95
71
 
96
- action "Run pending migrations" do
97
- ActiveRecord::Tasks::DatabaseTasks.migrate
98
- end
99
- end
100
- ```
72
+ (-1.year - 1.day).iso8601
73
+ # => "-P1Y1D"
101
74
 
102
- To make an error actionable, include the `ActiveSupport::ActionableError`
103
- module and invoke the `action` class macro to define the action. An action
104
- needs a name and a procedure to execute. The name is shown as the name of a
105
- button on the error pages. Once clicked, it will invoke the given
106
- procedure.
75
+ After:
107
76
 
108
- *Vipul A M*, *Yao Jie*, *Genadi Samokovarov*
77
+ (-1.year - 1.day).iso8601
78
+ # => "P-1Y-1D"
109
79
 
110
- * Preserve `html_safe?` status on `ActiveSupport::SafeBuffer#*`.
80
+ *Vipul A M*
111
81
 
112
- Before:
82
+ * Remove deprecated `ActiveSupport::Notifications::Instrumenter#end=`.
113
83
 
114
- ("<br />".html_safe * 2).html_safe? #=> nil
84
+ *Rafael Mendonça França*
115
85
 
116
- After:
86
+ * Deprecate `ActiveSupport::Multibyte::Unicode.default_normalization_form`.
117
87
 
118
- ("<br />".html_safe * 2).html_safe? #=> true
88
+ *Rafael Mendonça França*
119
89
 
120
- *Ryo Nakamura*
90
+ * Remove deprecated `ActiveSupport::Multibyte::Unicode.pack_graphemes`,
91
+ `ActiveSupport::Multibyte::Unicode.unpack_graphemes`,
92
+ `ActiveSupport::Multibyte::Unicode.normalize`,
93
+ `ActiveSupport::Multibyte::Unicode.downcase`,
94
+ `ActiveSupport::Multibyte::Unicode.upcase` and `ActiveSupport::Multibyte::Unicode.swapcase`.
121
95
 
122
- * Calling test methods with `with_info_handler` method to allow minitest-hooks
123
- plugin to work.
96
+ *Rafael Mendonça França*
124
97
 
125
- *Mauri Mustonen*
98
+ * Remove deprecated `ActiveSupport::Multibyte::Chars#consumes?` and `ActiveSupport::Multibyte::Chars#normalize`.
126
99
 
127
- * The Zeitwerk compatibility interface for `ActiveSupport::Dependencies` no
128
- longer implements `autoloaded_constants` or `autoloaded?` (undocumented,
129
- anyway). Experience shows introspection does not have many use cases, and
130
- troubleshooting is done by logging. With this design trade-off we are able
131
- to use even less memory in all environments.
100
+ *Rafael Mendonça França*
132
101
 
133
- *Xavier Noria*
102
+ * Remove deprecated file `active_support/core_ext/range/include_range`.
134
103
 
135
- * Depends on Zeitwerk 2, which stores less metadata if reloading is disabled
136
- and hence uses less memory when `config.cache_classes` is `true`, a standard
137
- setup in production.
104
+ *Rafael Mendonça França*
138
105
 
139
- *Xavier Noria*
106
+ * Remove deprecated file `active_support/core_ext/hash/transform_values`.
140
107
 
141
- * In `:zeitwerk` mode, eager load directories in engines and applications only
142
- if present in their respective `config.eager_load_paths`.
108
+ *Rafael Mendonça França*
143
109
 
144
- A common use case for this is adding `lib` to `config.autoload_paths`, but
145
- not to `config.eager_load_paths`. In that configuration, for example, files
146
- in the `lib` directory should not be eager loaded.
110
+ * Remove deprecated file `active_support/core_ext/hash/compact`.
147
111
 
148
- *Xavier Noria*
112
+ *Rafael Mendonça França*
149
113
 
150
- * Fix bug in Range comparisons when comparing to an excluded-end Range
114
+ * Remove deprecated file `active_support/core_ext/array/prepend_and_append`.
151
115
 
152
- Before:
116
+ *Rafael Mendonça França*
153
117
 
154
- (1..10).cover?(1...11) # => false
118
+ * Remove deprecated file `active_support/core_ext/numeric/inquiry`.
155
119
 
156
- After:
120
+ *Rafael Mendonça França*
157
121
 
158
- (1..10).cover?(1...11) # => true
122
+ * Remove deprecated file `active_support/core_ext/module/reachable`.
159
123
 
160
- With the same change for `Range#include?` and `Range#===`.
124
+ *Rafael Mendonça França*
161
125
 
162
- *Owen Stephens*
126
+ * Remove deprecated `Module#parent_name`, `Module#parent` and `Module#parents`.
163
127
 
164
- * Use weak references in descendants tracker to allow anonymous subclasses to
165
- be garbage collected.
128
+ *Rafael Mendonça França*
166
129
 
167
- *Edgars Beigarts*
130
+ * Remove deprecated `ActiveSupport::LoggerThreadSafeLevel#after_initialize`.
168
131
 
169
- * Update `ActiveSupport::Notifications::Instrumenter#instrument` to make
170
- passing a block optional. This will let users use
171
- `ActiveSupport::Notifications` messaging features outside of
172
- instrumentation.
132
+ *Rafael Mendonça França*
173
133
 
174
- *Ali Ibrahim*
134
+ * Remove deprecated `LoggerSilence` constant.
175
135
 
176
- * Fix `Time#advance` to work with dates before 1001-03-07
136
+ *Rafael Mendonça França*
177
137
 
178
- Before:
138
+ * Remove deprecated fallback to `I18n.default_local` when `config.i18n.fallbacks` is empty.
179
139
 
180
- Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-05 00:00:00 UTC
140
+ *Rafael Mendonça França*
181
141
 
182
- After
142
+ * Remove entries from local cache on `RedisCacheStore#delete_matched`
183
143
 
184
- Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-06 00:00:00 UTC
144
+ Fixes #38627
185
145
 
186
- Note that this doesn't affect `DateTime#advance` as that doesn't use a proleptic calendar.
146
+ *ojab*
187
147
 
188
- *Andrew White*
148
+ * Speed up `ActiveSupport::SecurityUtils.fixed_length_secure_compare` by using
149
+ `OpenSSL.fixed_length_secure_compare`, if available.
189
150
 
190
- * In Zeitwerk mode, engines are now managed by the `main` autoloader. Engines may reference application constants, if the application is reloaded and we do not reload engines, they won't use the reloaded application code.
151
+ *Nate Matykiewicz*
191
152
 
192
- *Xavier Noria*
153
+ * `ActiveSupport::Cache::MemCacheStore` now checks `ENV["MEMCACHE_SERVERS"]` before falling back to `"localhost:11211"` if configured without any addresses.
193
154
 
194
- * Add support for supplying `locale` to `transliterate` and `parameterize`.
155
+ ```ruby
156
+ config.cache_store = :mem_cache_store
195
157
 
196
- I18n.backend.store_translations(:de, i18n: { transliterate: { rule: { "ü" => "ue" } } })
158
+ # is now equivalent to
197
159
 
198
- ActiveSupport::Inflector.transliterate("ü", locale: :de) # => "ue"
199
- "Fünf autos".parameterize(locale: :de) # => "fuenf-autos"
200
- ActiveSupport::Inflector.parameterize("Fünf autos", locale: :de) # => "fuenf-autos"
160
+ config.cache_store = :mem_cache_store, ENV["MEMCACHE_SERVERS"] || "localhost:11211"
201
161
 
202
- *Kaan Ozkan*, *Sharang Dashputre*
162
+ # instead of
203
163
 
204
- * Allow `Array#excluding` and `Enumerable#excluding` to deal with a passed array gracefully.
164
+ config.cache_store = :mem_cache_store, "localhost:11211" # ignores ENV["MEMCACHE_SERVERS"]
165
+ ```
205
166
 
206
- [ 1, 2, 3, 4, 5 ].excluding([4, 5]) # => [ 1, 2, 3 ]
167
+ *Sam Bostock*
207
168
 
208
- *DHH*
169
+ * `ActiveSupport::Subscriber#attach_to` now accepts an `inherit_all:` argument. When set to true,
170
+ it allows a subscriber to receive events for methods defined in the subscriber's ancestor class(es).
209
171
 
210
- * Renamed `Array#without` and `Enumerable#without` to `Array#excluding` and `Enumerable#excluding`, to create parity with
211
- `Array#including` and `Enumerable#including`. Retained the old names as aliases.
172
+ ```ruby
173
+ class ActionControllerSubscriber < ActiveSupport::Subscriber
174
+ attach_to :action_controller
212
175
 
213
- *DHH*
176
+ def start_processing(event)
177
+ info "Processing by #{event.payload[:controller]}##{event.payload[:action]} as #{format}"
178
+ end
214
179
 
215
- * Added `Array#including` and `Enumerable#including` to conveniently enlarge a collection with more members using a method rather than an operator:
180
+ def redirect_to(event)
181
+ info { "Redirected to #{event.payload[:location]}" }
182
+ end
183
+ end
216
184
 
217
- [ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ]
218
- post.authors.including(Current.person) # => All the authors plus the current person!
185
+ # We detach ActionControllerSubscriber from the :action_controller namespace so that our CustomActionControllerSubscriber
186
+ # can provide its own instrumentation for certain events in the namespace
187
+ ActionControllerSubscriber.detach_from(:action_controller)
219
188
 
220
- *DHH*
189
+ class CustomActionControllerSubscriber < ActionControllerSubscriber
190
+ attach_to :action_controller, inherit_all: true
221
191
 
192
+ def start_processing(event)
193
+ info "A custom response to start_processing events"
194
+ end
222
195
 
223
- ## Rails 6.0.0.beta3 (March 11, 2019) ##
196
+ # => CustomActionControllerSubscriber will process events for "start_processing.action_controller" notifications
197
+ # using its own #start_processing implementation, while retaining ActionControllerSubscriber's instrumentation
198
+ # for "redirect_to.action_controller" notifications
199
+ end
200
+ ```
224
201
 
225
- * No changes.
202
+ *Adrianna Chang*
226
203
 
204
+ * Allow the digest class used to generate non-sensitive digests to be configured with `config.active_support.hash_digest_class`.
227
205
 
228
- ## Rails 6.0.0.beta2 (February 25, 2019) ##
206
+ `config.active_support.use_sha1_digests` is deprecated in favour of `config.active_support.hash_digest_class = ::Digest::SHA1`.
229
207
 
230
- * New autoloading based on [Zeitwerk](https://github.com/fxn/zeitwerk).
208
+ *Dirkjan Bussink*
231
209
 
232
- *Xavier Noria*
210
+ * Fix bug to make memcached write_entry expire correctly with unless_exist
233
211
 
234
- * Revise `ActiveSupport::Notifications.unsubscribe` to correctly handle Regex or other multiple-pattern subscribers.
212
+ *Jye Lee*
235
213
 
236
- *Zach Kemp*
214
+ * Add `ActiveSupport::Duration` conversion methods
237
215
 
238
- * Add `before_reset` callback to `CurrentAttributes` and define `after_reset` as an alias of `resets` for symmetry.
216
+ `in_seconds`, `in_minutes`, `in_hours`, `in_days`, `in_weeks`, `in_months`, and `in_years` return the respective duration covered.
239
217
 
240
- *Rosa Gutierrez*
218
+ *Jason York*
241
219
 
242
- * Remove the `` Kernel#` `` override that suppresses ENOENT and accidentally returns nil on Unix systems.
220
+ * Fixed issue in `ActiveSupport::Cache::RedisCacheStore` not passing options
221
+ to `read_multi` causing `fetch_multi` to not work properly
243
222
 
244
- *Akinori Musha*
223
+ *Rajesh Sharma*
245
224
 
246
- * Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
225
+ * Fixed issue in `ActiveSupport::Cache::MemCacheStore` which caused duplicate compression,
226
+ and caused the provided `compression_threshold` to not be respected.
247
227
 
248
- `assoc` can now be called with either a string or a symbol.
228
+ *Max Gurewitz*
249
229
 
250
- *Stefan Schüßler*
230
+ * Prevent `RedisCacheStore` and `MemCacheStore` from performing compression
231
+ when reading entries written with `raw: true`.
251
232
 
252
- * Add `Hash#deep_transform_values`, and `Hash#deep_transform_values!`.
233
+ *Max Gurewitz*
253
234
 
254
- *Guillermo Iguaran*
235
+ * `URI.parser` is deprecated and will be removed in Rails 6.2. Use
236
+ `URI::DEFAULT_PARSER` instead.
255
237
 
238
+ *Jean Boussier*
256
239
 
257
- ## Rails 6.0.0.beta1 (January 18, 2019) ##
240
+ * `require_dependency` has been documented to be _obsolete_ in `:zeitwerk`
241
+ mode. The method is not deprecated as such (yet), but applications are
242
+ encouraged to not use it.
258
243
 
259
- * Remove deprecated `Module#reachable?` method.
244
+ In `:zeitwerk` mode, semantics match Ruby's and you do not need to be
245
+ defensive with load order. Just refer to classes and modules normally. If
246
+ the constant name is dynamic, camelize if needed, and constantize.
260
247
 
261
- *Rafael Mendonça França*
248
+ *Xavier Noria*
262
249
 
263
- * Remove deprecated `#acronym_regex` method from `Inflections`.
250
+ * Add 3rd person aliases of `Symbol#start_with?` and `Symbol#end_with?`.
264
251
 
265
- *Rafael Mendonça França*
266
-
267
- * Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
252
+ ```ruby
253
+ :foo.starts_with?("f") # => true
254
+ :foo.ends_with?("o") # => true
255
+ ```
268
256
 
269
- *Keenan Brock*
257
+ *Ryuta Kamizono*
270
258
 
271
- * Preserve key order passed to `ActiveSupport::CacheStore#fetch_multi`.
259
+ * Add override of unary plus for `ActiveSupport::Duration`.
272
260
 
273
- `fetch_multi(*names)` now returns its results in the same order as the `*names` requested, rather than returning cache hits followed by cache misses.
261
+ `+ 1.second` is now identical to `+1.second` to prevent errors
262
+ where a seemingly innocent change of formatting leads to a change in the code behavior.
274
263
 
275
- *Gannon McGibbon*
264
+ Before:
265
+ ```ruby
266
+ +1.second.class
267
+ # => ActiveSupport::Duration
268
+ (+ 1.second).class
269
+ # => Integer
270
+ ```
276
271
 
277
- * If the same block is `included` multiple times for a Concern, an exception is no longer raised.
272
+ After:
273
+ ```ruby
274
+ +1.second.class
275
+ # => ActiveSupport::Duration
276
+ (+ 1.second).class
277
+ # => ActiveSupport::Duration
278
+ ```
278
279
 
279
- *Mark J. Titorenko*, *Vlad Bokov*
280
+ Fixes #39079.
280
281
 
281
- * Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
282
- would not act as alias for `#symbolize_keys`.
282
+ *Roman Kushnir*
283
283
 
284
- *Nick Weiland*
284
+ * Add subsec to `ActiveSupport::TimeWithZone#inspect`.
285
285
 
286
- * Improve the logic that detects non-autoloaded constants.
286
+ Before:
287
287
 
288
- *Jan Habermann*, *Xavier Noria*
288
+ Time.at(1498099140).in_time_zone.inspect
289
+ # => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
290
+ Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
291
+ # => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
292
+ Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
293
+ # => "Thu, 22 Jun 2017 02:39:00 UTC +00:00"
289
294
 
290
- * Deprecate `ActiveSupport::Multibyte::Unicode#pack_graphemes(array)` and `ActiveSuppport::Multibyte::Unicode#unpack_graphemes(string)`
291
- in favor of `array.flatten.pack("U*")` and `string.scan(/\X/).map(&:codepoints)`, respectively.
295
+ After:
292
296
 
293
- *Francesco Rodríguez*
297
+ Time.at(1498099140).in_time_zone.inspect
298
+ # => "Thu, 22 Jun 2017 02:39:00.000000000 UTC +00:00"
299
+ Time.at(1498099140, 123456780, :nsec).in_time_zone.inspect
300
+ # => "Thu, 22 Jun 2017 02:39:00.123456780 UTC +00:00"
301
+ Time.at(1498099140 + Rational("1/3")).in_time_zone.inspect
302
+ # => "Thu, 22 Jun 2017 02:39:00.333333333 UTC +00:00"
294
303
 
295
- * Deprecate `ActiveSupport::Multibyte::Chars.consumes?` in favor of `String#is_utf8?`.
304
+ *akinomaeni*
296
305
 
297
- *Francesco Rodríguez*
306
+ * Calling `ActiveSupport::TaggedLogging#tagged` without a block now returns a tagged logger.
298
307
 
299
- * Fix duration being rounded to a full second.
300
- ```
301
- time = DateTime.parse("2018-1-1")
302
- time += 0.51.seconds
308
+ ```ruby
309
+ logger.tagged("BCX").info("Funky time!") # => [BCX] Funky time!
303
310
  ```
304
- Will now correctly add 0.51 second and not 1 full second.
305
311
 
306
- *Edouard Chin*
312
+ *Eugene Kenny*
307
313
 
308
- * Deprecate `ActiveSupport::Multibyte::Unicode#normalize` and `ActiveSuppport::Multibyte::Chars#normalize`
309
- in favor of `String#unicode_normalize`
314
+ * Align `Range#cover?` extension behavior with Ruby behavior for backwards ranges.
310
315
 
311
- *Francesco Rodríguez*
316
+ `(1..10).cover?(5..3)` now returns `false`, as it does in plain Ruby.
312
317
 
313
- * Deprecate `ActiveSupport::Multibyte::Unicode#downcase/upcase/swapcase` in favor of
314
- `String#downcase/upcase/swapcase`.
318
+ Also update `#include?` and `#===` behavior to match.
315
319
 
316
- *Francesco Rodríguez*
320
+ *Michael Groeneman*
317
321
 
318
- * Add `ActiveSupport::ParameterFilter`.
322
+ * Update to TZInfo v2.0.0.
319
323
 
320
- *Yoshiyuki Kinjo*
324
+ This changes the output of `ActiveSupport::TimeZone.utc_to_local`, but
325
+ can be controlled with the
326
+ `ActiveSupport.utc_to_local_returns_utc_offset_times` config.
321
327
 
322
- * Rename `Module#parent`, `Module#parents`, and `Module#parent_name` to
323
- `module_parent`, `module_parents`, and `module_parent_name`.
328
+ New Rails 6.1 apps have it enabled by default, existing apps can upgrade
329
+ via the config in config/initializers/new_framework_defaults_6_1.rb
324
330
 
325
- *Gannon McGibbon*
331
+ See the `utc_to_local_returns_utc_offset_times` documentation for details.
326
332
 
327
- * Deprecate the use of `LoggerSilence` in favor of `ActiveSupport::LoggerSilence`
333
+ *Phil Ross*, *Jared Beck*
328
334
 
329
- *Edouard Chin*
335
+ * Add Date and Time `#yesterday?` and `#tomorrow?` alongside `#today?`.
330
336
 
331
- * Deprecate using negative limits in `String#first` and `String#last`.
337
+ Aliased to `#prev_day?` and `#next_day?` to match the existing `#prev/next_day` methods.
332
338
 
333
- *Gannon McGibbon*, *Eric Turner*
339
+ *Jatin Dhankhar*
334
340
 
335
- * Fix bug where `#without` for `ActiveSupport::HashWithIndifferentAccess` would fail
336
- with symbol arguments
341
+ * Add `Enumerable#pick` to complement `ActiveRecord::Relation#pick`.
337
342
 
338
- *Abraham Chan*
343
+ *Eugene Kenny*
339
344
 
340
- * Treat `#delete_prefix`, `#delete_suffix` and `#unicode_normalize` results as non-`html_safe`.
341
- Ensure safety of arguments for `#insert`, `#[]=` and `#replace` calls on `html_safe` Strings.
345
+ * [Breaking change] `ActiveSupport::Callbacks#halted_callback_hook` now receive a 2nd argument:
342
346
 
343
- *Janosch Müller*
347
+ `ActiveSupport::Callbacks#halted_callback_hook` now receive the name of the callback
348
+ being halted as second argument.
349
+ This change will allow you to differentiate which callbacks halted the chain
350
+ and act accordingly.
344
351
 
345
- * Changed `ActiveSupport::TaggedLogging.new` to return a new logger instance instead
346
- of mutating the one received as parameter.
352
+ ```ruby
353
+ class Book < ApplicationRecord
354
+ before_save { throw(:abort) }
355
+ before_create { throw(:abort) }
347
356
 
348
- *Thierry Joyal*
357
+ def halted_callback_hook(filter, callback_name)
358
+ Rails.logger.info("Book couldn't be #{callback_name}d")
359
+ end
349
360
 
350
- * Define `unfreeze_time` as an alias of `travel_back` in `ActiveSupport::Testing::TimeHelpers`.
361
+ Book.create # => "Book couldn't be created"
362
+ book.save # => "Book couldn't be saved"
363
+ end
364
+ ```
351
365
 
352
- The alias is provided for symmetry with `freeze_time`.
366
+ *Edouard Chin*
353
367
 
354
- *Ryan Davidson*
368
+ * Support `prepend` with `ActiveSupport::Concern`.
355
369
 
356
- * Add support for tracing constant autoloads. Just throw
370
+ Allows a module with `extend ActiveSupport::Concern` to be prepended.
357
371
 
358
- ActiveSupport::Dependencies.logger = Rails.logger
359
- ActiveSupport::Dependencies.verbose = true
372
+ module Imposter
373
+ extend ActiveSupport::Concern
360
374
 
361
- in an initializer.
375
+ # Same as `included`, except only run when prepended.
376
+ prepended do
377
+ end
378
+ end
362
379
 
363
- *Xavier Noria*
380
+ class Person
381
+ prepend Imposter
382
+ end
364
383
 
365
- * Maintain `html_safe?` on html_safe strings when sliced.
384
+ Class methods are prepended to the base class, concerning is also
385
+ updated: `concerning :Imposter, prepend: true do`.
366
386
 
367
- string = "<div>test</div>".html_safe
368
- string[-1..1].html_safe? # => true
387
+ *Jason Karns*, *Elia Schito*
369
388
 
370
- *Elom Gomez*, *Yumin Wong*
389
+ * Deprecate using `Range#include?` method to check the inclusion of a value
390
+ in a date time range. It is recommended to use `Range#cover?` method
391
+ instead of `Range#include?` to check the inclusion of a value
392
+ in a date time range.
371
393
 
372
- * Add `Array#extract!`.
394
+ *Vishal Telangre*
373
395
 
374
- The method removes and returns the elements for which the block returns a true value.
375
- If no block is given, an Enumerator is returned instead.
396
+ * Support added for a `round_mode` parameter, in all number helpers. (See: `BigDecimal::mode`.)
376
397
 
377
- numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
378
- odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9]
379
- numbers # => [0, 2, 4, 6, 8]
398
+ ```ruby
399
+ number_to_currency(1234567890.50, precision: 0, round_mode: :half_down) # => "$1,234,567,890"
400
+ number_to_percentage(302.24398923423, precision: 5, round_mode: :down) # => "302.24398%"
401
+ number_to_rounded(389.32314, precision: 0, round_mode: :ceil) # => "390"
402
+ number_to_human_size(483989, precision: 2, round_mode: :up) # => "480 KB"
403
+ number_to_human(489939, precision: 2, round_mode: :floor) # => "480 Thousand"
380
404
 
381
- *bogdanvlviv*
405
+ 485000.to_s(:human, precision: 2, round_mode: :half_even) # => "480 Thousand"
406
+ ```
382
407
 
383
- * Support not to cache `nil` for `ActiveSupport::Cache#fetch`.
408
+ *Tom Lord*
384
409
 
385
- cache.fetch('bar', skip_nil: true) { nil }
386
- cache.exist?('bar') # => false
410
+ * `Array#to_sentence` no longer returns a frozen string.
387
411
 
388
- *Martin Hong*
412
+ Before:
389
413
 
390
- * Add "event object" support to the notification system.
391
- Before this change, end users were forced to create hand made artisanal
392
- event objects on their own, like this:
414
+ ['one', 'two'].to_sentence.frozen?
415
+ # => true
393
416
 
394
- ActiveSupport::Notifications.subscribe('wait') do |*args|
395
- @event = ActiveSupport::Notifications::Event.new(*args)
396
- end
417
+ After:
397
418
 
398
- ActiveSupport::Notifications.instrument('wait') do
399
- sleep 1
400
- end
419
+ ['one', 'two'].to_sentence.frozen?
420
+ # => false
401
421
 
402
- @event.duration # => 1000.138
422
+ *Nicolas Dular*
403
423
 
404
- After this change, if the block passed to `subscribe` only takes one
405
- parameter, the framework will yield an event object to the block. Now
406
- end users are no longer required to make their own:
424
+ * When an instance of `ActiveSupport::Duration` is converted to an `iso8601` duration string, if `weeks` are mixed with `date` parts, the `week` part will be converted to days.
425
+ This keeps the parser and serializer on the same page.
407
426
 
408
- ActiveSupport::Notifications.subscribe('wait') do |event|
409
- @event = event
410
- end
427
+ ```ruby
428
+ duration = ActiveSupport::Duration.build(1000000)
429
+ # 1 week, 4 days, 13 hours, 46 minutes, and 40.0 seconds
411
430
 
412
- ActiveSupport::Notifications.instrument('wait') do
413
- sleep 1
414
- end
431
+ duration_iso = duration.iso8601
432
+ # P11DT13H46M40S
415
433
 
416
- p @event.allocations # => 7
417
- p @event.cpu_time # => 0.256
418
- p @event.idle_time # => 1003.2399
434
+ ActiveSupport::Duration.parse(duration_iso)
435
+ # 11 days, 13 hours, 46 minutes, and 40 seconds
419
436
 
420
- Now you can enjoy event objects without making them yourself. Neat!
437
+ duration = ActiveSupport::Duration.build(604800)
438
+ # 1 week
421
439
 
422
- *Aaron "t.lo" Patterson*
440
+ duration_iso = duration.iso8601
441
+ # P1W
423
442
 
424
- * Add cpu_time, idle_time, and allocations to Event.
443
+ ActiveSupport::Duration.parse(duration_iso)
444
+ # 1 week
445
+ ```
425
446
 
426
- *Eileen M. Uchitelle*, *Aaron Patterson*
447
+ *Abhishek Sarkar*
427
448
 
428
- * RedisCacheStore: support key expiry in increment/decrement.
449
+ * Add block support to `ActiveSupport::Testing::TimeHelpers#travel_back`.
429
450
 
430
- Pass `:expires_in` to `#increment` and `#decrement` to set a Redis EXPIRE on the key.
451
+ *Tim Masliuchenko*
431
452
 
432
- If the key is already set to expire, RedisCacheStore won't extend its expiry.
453
+ * Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
454
+ `ActiveSupport.parse_json_times = true`.
433
455
 
434
- Rails.cache.increment("some_key", 1, expires_in: 2.minutes)
456
+ *Christian Gregg*
435
457
 
436
- *Jason Lee*
458
+ * Support symbolic links for `content_path` in `ActiveSupport::EncryptedFile`.
437
459
 
438
- * Allow `Range#===` and `Range#cover?` on Range.
460
+ *Takumi Shotoku*
439
461
 
440
- `Range#cover?` can now accept a range argument like `Range#include?` and
441
- `Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
442
- into a new file, with these two methods.
462
+ * Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
463
+ and endless range targets.
443
464
 
444
- *Requiring active_support/core_ext/range/include_range is now deprecated.*
445
- *Use `require "active_support/core_ext/range/compare_range"` instead.*
465
+ *Allen Hsu*, *Andrew Hodgkinson*
446
466
 
447
- *utilum*
467
+ * Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
448
468
 
449
- * Add `index_with` to Enumerable.
469
+ *Iain Beeston*
450
470
 
451
- Allows creating a hash from an enumerable with the value from a passed block
452
- or a default argument.
471
+ * Prevent `ActiveSupport::Duration.build(value)` from creating instances of
472
+ `ActiveSupport::Duration` unless `value` is of type `Numeric`.
453
473
 
454
- %i( title body ).index_with { |attr| post.public_send(attr) }
455
- # => { title: "hey", body: "what's up?" }
474
+ Addresses the errant set of behaviours described in #37012 where
475
+ `ActiveSupport::Duration` comparisons would fail confusingly
476
+ or return unexpected results when comparing durations built from instances of `String`.
456
477
 
457
- %i( title body ).index_with(nil)
458
- # => { title: nil, body: nil }
478
+ Before:
459
479
 
460
- Closely linked with `index_by`, which creates a hash where the keys are extracted from a block.
480
+ small_duration_from_string = ActiveSupport::Duration.build('9')
481
+ large_duration_from_string = ActiveSupport::Duration.build('100000000000000')
482
+ small_duration_from_int = ActiveSupport::Duration.build(9)
461
483
 
462
- *Kasper Timm Hansen*
484
+ large_duration_from_string > small_duration_from_string
485
+ # => false
463
486
 
464
- * Fix bug where `ActiveSupport::TimeZone.all` would fail when tzinfo data for
465
- any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
487
+ small_duration_from_string == small_duration_from_int
488
+ # => false
466
489
 
467
- *Dominik Sander*
490
+ small_duration_from_int < large_duration_from_string
491
+ # => ArgumentError (comparison of ActiveSupport::Duration::Scalar with ActiveSupport::Duration failed)
468
492
 
469
- * Redis cache store: `delete_matched` no longer blocks the Redis server.
470
- (Switches from evaled Lua to a batched SCAN + DEL loop.)
493
+ large_duration_from_string > small_duration_from_int
494
+ # => ArgumentError (comparison of String with ActiveSupport::Duration failed)
471
495
 
472
- *Gleb Mazovetskiy*
496
+ After:
473
497
 
474
- * Fix bug where `ActiveSupport::Cache` will massively inflate the storage
475
- size when compression is enabled (which is true by default). This patch
476
- does not attempt to repair existing data: please manually flush the cache
477
- to clear out the problematic entries.
498
+ small_duration_from_string = ActiveSupport::Duration.build('9')
499
+ # => TypeError (can't build an ActiveSupport::Duration from a String)
478
500
 
479
- *Godfrey Chan*
501
+ *Alexei Emam*
480
502
 
481
- * Fix bug where `URI.unescape` would fail with mixed Unicode/escaped character input:
503
+ * Add `ActiveSupport::Cache::Store#delete_multi` method to delete multiple keys from the cache store.
482
504
 
483
- URI.unescape("\xe3\x83\x90") # => "バ"
484
- URI.unescape("%E3%83%90") # => "バ"
485
- URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
505
+ *Peter Zhu*
486
506
 
487
- *Ashe Connor*, *Aaron Patterson*
507
+ * Support multiple arguments in `HashWithIndifferentAccess` for `merge` and `update` methods, to
508
+ follow Ruby 2.6 addition.
488
509
 
489
- * Add `before?` and `after?` methods to `Date`, `DateTime`,
490
- `Time`, and `TimeWithZone`.
510
+ *Wojciech Wnętrzak*
491
511
 
492
- *Nick Holden*
512
+ * Allow initializing `thread_mattr_*` attributes via `:default` option.
493
513
 
494
- * `ActiveSupport::Inflector#ordinal` and `ActiveSupport::Inflector#ordinalize` now support
495
- translations through I18n.
514
+ class Scraper
515
+ thread_mattr_reader :client, default: Api::Client.new
516
+ end
496
517
 
497
- # locale/fr.rb
518
+ *Guilherme Mansur*
498
519
 
499
- {
500
- fr: {
501
- number: {
502
- nth: {
503
- ordinals: lambda do |_key, number:, **_options|
504
- if number.to_i.abs == 1
505
- 'er'
506
- else
507
- 'e'
508
- end
509
- end,
520
+ * Add `compact_blank` for those times when you want to remove #blank? values from
521
+ an Enumerable (also `compact_blank!` on Hash, Array, ActionController::Parameters).
510
522
 
511
- ordinalized: lambda do |_key, number:, **_options|
512
- "#{number}#{ActiveSupport::Inflector.ordinal(number)}"
513
- end
514
- }
515
- }
516
- }
517
- }
523
+ *Dana Sherson*
518
524
 
525
+ * Make ActiveSupport::Logger Fiber-safe.
519
526
 
520
- *Christian Blais*
527
+ Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
528
+ to make log level local to Ruby Fibers in addition to Threads.
521
529
 
522
- * Add `:private` option to ActiveSupport's `Module#delegate`
523
- in order to delegate methods as private:
530
+ Example:
524
531
 
525
- class User < ActiveRecord::Base
526
- has_one :profile
527
- delegate :date_of_birth, to: :profile, private: true
532
+ logger = ActiveSupport::Logger.new(STDOUT)
533
+ logger.level = 1
534
+ puts "Main is debug? #{logger.debug?}"
528
535
 
529
- def age
530
- Date.today.year - date_of_birth.year
531
- end
532
- end
536
+ Fiber.new {
537
+ logger.local_level = 0
538
+ puts "Thread is debug? #{logger.debug?}"
539
+ }.resume
533
540
 
534
- # User.new.age # => 29
535
- # User.new.date_of_birth
536
- # => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340>
541
+ puts "Main is debug? #{logger.debug?}"
537
542
 
538
- *Tomas Valent*
543
+ Before:
539
544
 
540
- * `String#truncate_bytes` to truncate a string to a maximum bytesize without
541
- breaking multibyte characters or grapheme clusters like 👩‍👩‍👦‍👦.
545
+ Main is debug? false
546
+ Thread is debug? true
547
+ Main is debug? true
542
548
 
543
- *Jeremy Daer*
549
+ After:
544
550
 
545
- * `String#strip_heredoc` preserves frozenness.
551
+ Main is debug? false
552
+ Thread is debug? true
553
+ Main is debug? false
546
554
 
547
- "foo".freeze.strip_heredoc.frozen? # => true
555
+ Fixes #36752.
548
556
 
549
- Fixes that frozen string literals would inadvertently become unfrozen:
557
+ *Alexander Varnin*
550
558
 
551
- # frozen_string_literal: true
559
+ * Allow the `on_rotation` proc used when decrypting/verifying a message to be
560
+ passed at the constructor level.
552
561
 
553
- foo = <<-MSG.strip_heredoc
554
- la la la
555
- MSG
562
+ Before:
556
563
 
557
- foo.frozen? # => false !??
564
+ crypt = ActiveSupport::MessageEncryptor.new('long_secret')
565
+ crypt.decrypt_and_verify(encrypted_message, on_rotation: proc { ... })
566
+ crypt.decrypt_and_verify(another_encrypted_message, on_rotation: proc { ... })
558
567
 
559
- *Jeremy Daer*
568
+ After:
560
569
 
561
- * Rails 6 requires Ruby 2.5.0 or newer.
570
+ crypt = ActiveSupport::MessageEncryptor.new('long_secret', on_rotation: proc { ... })
571
+ crypt.decrypt_and_verify(encrypted_message)
572
+ crypt.decrypt_and_verify(another_encrypted_message)
562
573
 
563
- *Jeremy Daer*, *Kasper Timm Hansen*
574
+ *Edouard Chin*
564
575
 
565
- * Adds parallel testing to Rails.
576
+ * `delegate_missing_to` would raise a `DelegationError` if the object
577
+ delegated to was `nil`. Now the `allow_nil` option has been added to enable
578
+ the user to specify they want `nil` returned in this case.
566
579
 
567
- Parallelize your test suite with forked processes or threads.
580
+ *Matthew Tanous*
568
581
 
569
- *Eileen M. Uchitelle*, *Aaron Patterson*
582
+ * `truncate` would return the original string if it was too short to be truncated
583
+ and a frozen string if it were long enough to be truncated. Now truncate will
584
+ consistently return an unfrozen string regardless. This behavior is consistent
585
+ with `gsub` and `strip`.
586
+
587
+ Before:
588
+
589
+ 'foobar'.truncate(5).frozen?
590
+ # => true
591
+ 'foobar'.truncate(6).frozen?
592
+ # => false
593
+
594
+ After:
595
+
596
+ 'foobar'.truncate(5).frozen?
597
+ # => false
598
+ 'foobar'.truncate(6).frozen?
599
+ # => false
600
+
601
+ *Jordan Thomas*
570
602
 
571
603
 
572
- Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/activesupport/CHANGELOG.md) for previous changes.
604
+ Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activesupport/CHANGELOG.md) for previous changes.