activesupport 5.2.7 → 6.0.0.beta1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +182 -566
- data/MIT-LICENSE +1 -1
- data/README.rdoc +1 -1
- data/lib/active_support/backtrace_cleaner.rb +23 -0
- data/lib/active_support/cache/file_store.rb +19 -12
- data/lib/active_support/cache/mem_cache_store.rb +16 -2
- data/lib/active_support/cache/memory_store.rb +5 -0
- data/lib/active_support/cache/null_store.rb +5 -0
- data/lib/active_support/cache/redis_cache_store.rb +39 -20
- data/lib/active_support/cache.rb +40 -18
- data/lib/active_support/callbacks.rb +16 -5
- data/lib/active_support/configurable.rb +4 -8
- data/lib/active_support/core_ext/array/extract.rb +21 -0
- data/lib/active_support/core_ext/array/prepend_and_append.rb +2 -6
- data/lib/active_support/core_ext/array.rb +1 -1
- data/lib/active_support/core_ext/class/attribute.rb +1 -1
- data/lib/active_support/core_ext/class/subclasses.rb +1 -1
- data/lib/active_support/core_ext/date/calculations.rb +6 -5
- data/lib/active_support/core_ext/date_and_time/calculations.rb +24 -17
- data/lib/active_support/core_ext/date_time/calculations.rb +1 -1
- data/lib/active_support/core_ext/enumerable.rb +71 -67
- data/lib/active_support/core_ext/hash/compact.rb +2 -26
- data/lib/active_support/core_ext/hash/keys.rb +0 -29
- data/lib/active_support/core_ext/hash/slice.rb +3 -25
- data/lib/active_support/core_ext/hash/transform_values.rb +2 -29
- data/lib/active_support/core_ext/hash.rb +0 -2
- data/lib/active_support/core_ext/integer/multiple.rb +1 -1
- data/lib/active_support/core_ext/load_error.rb +1 -1
- data/lib/active_support/core_ext/module/attribute_accessors.rb +2 -5
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +8 -14
- data/lib/active_support/core_ext/module/delegation.rb +27 -7
- data/lib/active_support/core_ext/module/introspection.rb +37 -13
- data/lib/active_support/core_ext/module/reachable.rb +1 -6
- data/lib/active_support/core_ext/module/redefine_method.rb +8 -17
- data/lib/active_support/core_ext/module.rb +0 -1
- data/lib/active_support/core_ext/numeric/conversions.rb +124 -128
- data/lib/active_support/core_ext/numeric/inquiry.rb +2 -25
- data/lib/active_support/core_ext/numeric.rb +0 -1
- data/lib/active_support/core_ext/object/blank.rb +1 -2
- data/lib/active_support/core_ext/object/duplicable.rb +5 -2
- data/lib/active_support/core_ext/object/json.rb +1 -0
- data/lib/active_support/core_ext/object/try.rb +15 -7
- data/lib/active_support/core_ext/object/with_options.rb +1 -1
- data/lib/active_support/core_ext/range/compare_range.rb +1 -1
- data/lib/active_support/core_ext/range/conversions.rb +31 -29
- data/lib/active_support/core_ext/range/include_range.rb +6 -0
- data/lib/active_support/core_ext/regexp.rb +0 -4
- data/lib/active_support/core_ext/securerandom.rb +23 -3
- data/lib/active_support/core_ext/string/access.rb +8 -0
- data/lib/active_support/core_ext/string/filters.rb +41 -0
- data/lib/active_support/core_ext/string/multibyte.rb +4 -3
- data/lib/active_support/core_ext/string/output_safety.rb +16 -5
- data/lib/active_support/core_ext/string/strip.rb +3 -1
- data/lib/active_support/core_ext/uri.rb +1 -0
- data/lib/active_support/current_attributes.rb +2 -0
- data/lib/active_support/dependencies.rb +28 -11
- data/lib/active_support/deprecation/behaviors.rb +1 -1
- data/lib/active_support/deprecation/method_wrappers.rb +4 -5
- data/lib/active_support/deprecation/proxy_wrappers.rb +0 -2
- data/lib/active_support/deprecation.rb +1 -1
- data/lib/active_support/descendants_tracker.rb +6 -5
- data/lib/active_support/duration/iso8601_parser.rb +2 -3
- data/lib/active_support/duration/iso8601_serializer.rb +3 -4
- data/lib/active_support/duration.rb +12 -14
- data/lib/active_support/encrypted_configuration.rb +0 -4
- data/lib/active_support/evented_file_update_checker.rb +25 -7
- data/lib/active_support/execution_wrapper.rb +14 -16
- data/lib/active_support/gem_version.rb +4 -4
- data/lib/active_support/hash_with_indifferent_access.rb +16 -28
- data/lib/active_support/i18n.rb +1 -0
- data/lib/active_support/i18n_railtie.rb +8 -1
- data/lib/active_support/inflector/inflections.rb +1 -4
- data/lib/active_support/inflector/methods.rb +15 -27
- data/lib/active_support/inflector/transliterate.rb +6 -6
- data/lib/active_support/json/decoding.rb +23 -23
- data/lib/active_support/json/encoding.rb +6 -2
- data/lib/active_support/key_generator.rb +0 -32
- data/lib/active_support/lazy_load_hooks.rb +5 -1
- data/lib/active_support/locale/en.rb +31 -0
- data/lib/active_support/log_subscriber.rb +31 -8
- data/lib/active_support/logger.rb +0 -15
- data/lib/active_support/logger_silence.rb +28 -12
- data/lib/active_support/logger_thread_safe_level.rb +27 -6
- data/lib/active_support/message_encryptor.rb +2 -4
- data/lib/active_support/message_verifier.rb +2 -2
- data/lib/active_support/multibyte/chars.rb +29 -48
- data/lib/active_support/multibyte/unicode.rb +44 -281
- data/lib/active_support/notifications/fanout.rb +42 -4
- data/lib/active_support/notifications/instrumenter.rb +73 -2
- data/lib/active_support/notifications.rb +32 -4
- data/lib/active_support/number_helper/number_to_currency_converter.rb +2 -2
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +3 -1
- data/lib/active_support/number_helper/number_to_human_converter.rb +3 -1
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +3 -1
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +3 -1
- data/lib/active_support/number_helper/number_to_phone_converter.rb +2 -0
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +5 -3
- data/lib/active_support/number_helper.rb +7 -0
- data/lib/active_support/ordered_options.rb +1 -1
- data/lib/active_support/parameter_filter.rb +124 -0
- data/lib/active_support/rails.rb +0 -6
- data/lib/active_support/reloader.rb +5 -6
- data/lib/active_support/subscriber.rb +16 -26
- data/lib/active_support/tagged_logging.rb +13 -4
- data/lib/active_support/test_case.rb +91 -0
- data/lib/active_support/testing/assertions.rb +15 -1
- data/lib/active_support/testing/deprecation.rb +0 -1
- data/lib/active_support/testing/file_fixtures.rb +2 -0
- data/lib/active_support/testing/isolation.rb +2 -2
- data/lib/active_support/testing/method_call_assertions.rb +28 -1
- data/lib/active_support/testing/parallelization.rb +109 -0
- data/lib/active_support/testing/stream.rb +1 -1
- data/lib/active_support/testing/time_helpers.rb +7 -7
- data/lib/active_support/time_with_zone.rb +15 -5
- data/lib/active_support/values/time_zone.rb +12 -7
- data/lib/active_support/xml_mini/jdom.rb +2 -2
- data/lib/active_support/xml_mini/libxml.rb +2 -2
- data/lib/active_support/xml_mini/libxmlsax.rb +4 -4
- data/lib/active_support/xml_mini/nokogiri.rb +2 -2
- data/lib/active_support/xml_mini/nokogirisax.rb +3 -3
- data/lib/active_support/xml_mini/rexml.rb +2 -2
- data/lib/active_support/xml_mini.rb +2 -9
- data/lib/active_support.rb +1 -1
- metadata +12 -10
- data/lib/active_support/core_ext/digest.rb +0 -3
- data/lib/active_support/values/unicode_tables.dat +0 -0
data/CHANGELOG.md
CHANGED
@@ -1,133 +1,27 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 6.0.0.beta1 (January 18, 2019) ##
|
2
2
|
|
3
|
-
*
|
3
|
+
* Remove deprecated `Module#reachable?` method.
|
4
4
|
|
5
|
-
*
|
6
|
-
|
7
|
-
|
8
|
-
## Rails 5.2.6.3 (March 08, 2022) ##
|
9
|
-
|
10
|
-
* No changes.
|
11
|
-
|
12
|
-
|
13
|
-
## Rails 5.2.6.2 (February 11, 2022) ##
|
14
|
-
|
15
|
-
* Fix Reloader method signature to work with the new Executor signature
|
16
|
-
|
17
|
-
|
18
|
-
## Rails 5.2.6.1 (February 11, 2022) ##
|
19
|
-
|
20
|
-
* No changes.
|
21
|
-
|
22
|
-
|
23
|
-
## Rails 5.2.6 (May 05, 2021) ##
|
24
|
-
|
25
|
-
* No changes.
|
26
|
-
|
27
|
-
|
28
|
-
## Rails 5.2.5 (March 26, 2021) ##
|
29
|
-
|
30
|
-
* No changes.
|
31
|
-
|
32
|
-
|
33
|
-
## Rails 5.2.4.6 (May 05, 2021) ##
|
34
|
-
|
35
|
-
* No changes.
|
36
|
-
|
37
|
-
|
38
|
-
## Rails 5.2.4.5 (February 10, 2021) ##
|
39
|
-
|
40
|
-
* No changes.
|
41
|
-
|
42
|
-
|
43
|
-
## Rails 5.2.4.4 (September 09, 2020) ##
|
44
|
-
|
45
|
-
* No changes.
|
46
|
-
|
47
|
-
|
48
|
-
## Rails 5.2.4.3 (May 18, 2020) ##
|
49
|
-
|
50
|
-
* [CVE-2020-8165] Deprecate Marshal.load on raw cache read in RedisCacheStore
|
51
|
-
|
52
|
-
* [CVE-2020-8165] Avoid Marshal.load on raw cache value in MemCacheStore
|
53
|
-
|
54
|
-
## Rails 5.2.4.2 (March 19, 2020) ##
|
55
|
-
|
56
|
-
* No changes.
|
57
|
-
|
58
|
-
|
59
|
-
## Rails 5.2.4.1 (December 18, 2019) ##
|
60
|
-
|
61
|
-
* No changes.
|
62
|
-
|
63
|
-
|
64
|
-
## Rails 5.2.4 (November 27, 2019) ##
|
65
|
-
|
66
|
-
* Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
|
67
|
-
|
68
|
-
Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
|
69
|
-
to make log level local to Ruby Fibers in addition to Threads.
|
70
|
-
|
71
|
-
Example:
|
72
|
-
|
73
|
-
logger = ActiveSupport::Logger.new(STDOUT)
|
74
|
-
logger.level = 1
|
75
|
-
p "Main is debug? #{logger.debug?}"
|
76
|
-
|
77
|
-
Fiber.new {
|
78
|
-
logger.local_level = 0
|
79
|
-
p "Thread is debug? #{logger.debug?}"
|
80
|
-
}.resume
|
81
|
-
|
82
|
-
p "Main is debug? #{logger.debug?}"
|
83
|
-
|
84
|
-
Before:
|
85
|
-
|
86
|
-
Main is debug? false
|
87
|
-
Thread is debug? true
|
88
|
-
Main is debug? true
|
89
|
-
|
90
|
-
After:
|
91
|
-
|
92
|
-
Main is debug? false
|
93
|
-
Thread is debug? true
|
94
|
-
Main is debug? false
|
95
|
-
|
96
|
-
*Alexander Varnin*
|
97
|
-
|
98
|
-
|
99
|
-
## Rails 5.2.3 (March 27, 2019) ##
|
100
|
-
|
101
|
-
* Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
|
5
|
+
*Rafael Mendonça França*
|
102
6
|
|
103
|
-
|
7
|
+
* Remove deprecated `#acronym_regex` method from `Inflections`.
|
104
8
|
|
105
|
-
*
|
9
|
+
*Rafael Mendonça França*
|
106
10
|
|
107
11
|
* Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
|
108
12
|
|
109
13
|
*Keenan Brock*
|
110
14
|
|
111
|
-
*
|
15
|
+
* Preserve key order passed to `ActiveSupport::CacheStore#fetch_multi`.
|
112
16
|
|
113
|
-
`
|
114
|
-
`Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
|
115
|
-
into a new file, with these two methods.
|
17
|
+
`fetch_multi(*names)` now returns its results in the same order as the `*names` requested, rather than returning cache hits followed by cache misses.
|
116
18
|
|
117
|
-
*
|
19
|
+
*Gannon McGibbon*
|
118
20
|
|
119
21
|
* If the same block is `included` multiple times for a Concern, an exception is no longer raised.
|
120
22
|
|
121
23
|
*Mark J. Titorenko*, *Vlad Bokov*
|
122
24
|
|
123
|
-
|
124
|
-
## Rails 5.2.2.1 (March 11, 2019) ##
|
125
|
-
|
126
|
-
* No changes.
|
127
|
-
|
128
|
-
|
129
|
-
## Rails 5.2.2 (December 04, 2018) ##
|
130
|
-
|
131
25
|
* Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
|
132
26
|
would not act as alias for `#symbolize_keys`.
|
133
27
|
|
@@ -137,564 +31,286 @@
|
|
137
31
|
|
138
32
|
*Jan Habermann*, *Xavier Noria*
|
139
33
|
|
140
|
-
*
|
141
|
-
|
142
|
-
URI.unescape("\xe3\x83\x90") # => "バ"
|
143
|
-
URI.unescape("%E3%83%90") # => "バ"
|
144
|
-
URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
|
145
|
-
|
146
|
-
*Ashe Connor*, *Aaron Patterson*
|
147
|
-
|
148
|
-
|
149
|
-
## Rails 5.2.1.1 (November 27, 2018) ##
|
150
|
-
|
151
|
-
* No changes.
|
152
|
-
|
153
|
-
|
154
|
-
## Rails 5.2.1 (August 07, 2018) ##
|
155
|
-
|
156
|
-
* Redis cache store: `delete_matched` no longer blocks the Redis server.
|
157
|
-
(Switches from evaled Lua to a batched SCAN + DEL loop.)
|
158
|
-
|
159
|
-
*Gleb Mazovetskiy*
|
160
|
-
|
161
|
-
* Fix bug where `ActiveSupport::Timezone.all` would fail when tzinfo data for
|
162
|
-
any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
|
163
|
-
|
164
|
-
*Dominik Sander*
|
165
|
-
|
166
|
-
* Fix bug where `ActiveSupport::Cache` will massively inflate the storage
|
167
|
-
size when compression is enabled (which is true by default). This patch
|
168
|
-
does not attempt to repair existing data: please manually flush the cache
|
169
|
-
to clear out the problematic entries.
|
170
|
-
|
171
|
-
*Godfrey Chan*
|
172
|
-
|
173
|
-
* Fix `ActiveSupport::Cache#read_multi` bug with local cache enabled that was
|
174
|
-
returning instances of `ActiveSupport::Cache::Entry` instead of the raw values.
|
175
|
-
|
176
|
-
*Jason Lee*
|
177
|
-
|
178
|
-
|
179
|
-
## Rails 5.2.0 (April 09, 2018) ##
|
180
|
-
|
181
|
-
* Caching: MemCache and Redis `read_multi` and `fetch_multi` speedup.
|
182
|
-
Read from the local in-memory cache before consulting the backend.
|
183
|
-
|
184
|
-
*Gabriel Sobrinho*
|
185
|
-
|
186
|
-
* Return all mappings for a timezone identifier in `country_zones`.
|
187
|
-
|
188
|
-
Some timezones like `Europe/London` have multiple mappings in
|
189
|
-
`ActiveSupport::TimeZone::MAPPING` so return all of them instead
|
190
|
-
of the first one found by using `Hash#value`. e.g:
|
191
|
-
|
192
|
-
# Before
|
193
|
-
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh"]
|
194
|
-
|
195
|
-
# After
|
196
|
-
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh", "London"]
|
197
|
-
|
198
|
-
Fixes #31668.
|
199
|
-
|
200
|
-
*Andrew White*
|
201
|
-
|
202
|
-
* Add support for connection pooling on RedisCacheStore.
|
203
|
-
|
204
|
-
*fatkodima*
|
205
|
-
|
206
|
-
* Support hash as first argument in `assert_difference`. This allows to specify multiple
|
207
|
-
numeric differences in the same assertion.
|
208
|
-
|
209
|
-
assert_difference ->{ Article.count } => 1, ->{ Post.count } => 2
|
210
|
-
|
211
|
-
*Julien Meichelbeck*
|
212
|
-
|
213
|
-
* Add missing instrumentation for `read_multi` in `ActiveSupport::Cache::Store`.
|
214
|
-
|
215
|
-
*Ignatius Reza Lesmana*
|
216
|
-
|
217
|
-
* `assert_changes` will always assert that the expression changes,
|
218
|
-
regardless of `from:` and `to:` argument combinations.
|
34
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#pack_graphemes(array)` and `ActiveSuppport::Multibyte::Unicode#unpack_graphemes(string)`
|
35
|
+
in favor of `array.flatten.pack("U*")` and `string.scan(/\X/).map(&:codepoints)`, respectively.
|
219
36
|
|
220
|
-
*
|
37
|
+
*Francesco Rodríguez*
|
221
38
|
|
222
|
-
*
|
39
|
+
* Deprecate `ActiveSupport::Multibyte::Chars.consumes?` in favor of `String#is_utf8?`.
|
223
40
|
|
224
|
-
|
225
|
-
`config.active_support.use_sha1_digests = true`.
|
226
|
-
|
227
|
-
*Dmitri Dolguikh*, *Eugene Kenny*
|
228
|
-
|
229
|
-
* Changed default behaviour of `ActiveSupport::SecurityUtils.secure_compare`,
|
230
|
-
to make it not leak length information even for variable length string.
|
231
|
-
|
232
|
-
Renamed old `ActiveSupport::SecurityUtils.secure_compare` to `fixed_length_secure_compare`,
|
233
|
-
and started raising `ArgumentError` in case of length mismatch of passed strings.
|
234
|
-
|
235
|
-
*Vipul A M*
|
236
|
-
|
237
|
-
* Make `ActiveSupport::TimeZone.all` return only time zones that are in
|
238
|
-
`ActiveSupport::TimeZone::MAPPING`.
|
239
|
-
|
240
|
-
Fixes #7245.
|
241
|
-
|
242
|
-
*Chris LaRose*
|
243
|
-
|
244
|
-
* MemCacheStore: Support expiring counters.
|
245
|
-
|
246
|
-
Pass `expires_in: [seconds]` to `#increment` and `#decrement` options
|
247
|
-
to set the Memcached TTL (time-to-live) if the counter doesn't exist.
|
248
|
-
If the counter exists, Memcached doesn't extend its expiry when it's
|
249
|
-
incremented or decremented.
|
41
|
+
*Francesco Rodríguez*
|
250
42
|
|
43
|
+
* Fix duration being rounded to a full second.
|
251
44
|
```
|
252
|
-
|
45
|
+
time = DateTime.parse("2018-1-1")
|
46
|
+
time += 0.51.seconds
|
253
47
|
```
|
48
|
+
Will now correctly add 0.51 second and not 1 full second.
|
254
49
|
|
255
|
-
*
|
256
|
-
|
257
|
-
* Handle `TZInfo::AmbiguousTime` errors.
|
258
|
-
|
259
|
-
Make `ActiveSupport::TimeWithZone` match Ruby's handling of ambiguous
|
260
|
-
times by choosing the later period, e.g.
|
261
|
-
|
262
|
-
Ruby:
|
263
|
-
```
|
264
|
-
ENV["TZ"] = "Europe/Moscow"
|
265
|
-
Time.local(2014, 10, 26, 1, 0, 0) # => 2014-10-26 01:00:00 +0300
|
266
|
-
```
|
50
|
+
*Edouard Chin*
|
267
51
|
|
268
|
-
|
269
|
-
|
270
|
-
>> "2014-10-26 01:00:00".in_time_zone("Moscow")
|
271
|
-
TZInfo::AmbiguousTime: 26/10/2014 01:00 is an ambiguous local time.
|
272
|
-
```
|
52
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#normalize` and `ActiveSuppport::Multibyte::Chars#normalize`
|
53
|
+
in favor of `String#unicode_normalize`
|
273
54
|
|
274
|
-
|
275
|
-
```
|
276
|
-
>> "2014-10-26 01:00:00".in_time_zone("Moscow")
|
277
|
-
=> Sun, 26 Oct 2014 01:00:00 MSK +03:00
|
278
|
-
```
|
55
|
+
*Francesco Rodríguez*
|
279
56
|
|
280
|
-
|
57
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#downcase/upcase/swapcase` in favor of
|
58
|
+
`String#downcase/upcase/swapcase`.
|
281
59
|
|
282
|
-
*
|
60
|
+
*Francesco Rodríguez*
|
283
61
|
|
284
|
-
*
|
62
|
+
* Add `ActiveSupport::ParameterFilter`.
|
285
63
|
|
286
|
-
|
287
|
-
# Defaults to `redis://localhost:6379/0`. Only use for dev/test.
|
288
|
-
config.cache_store = :redis_cache_store
|
289
|
-
|
290
|
-
# Supports all common cache store options (:namespace, :compress,
|
291
|
-
# :compress_threshold, :expires_in, :race_condition_ttl) and all
|
292
|
-
# Redis options.
|
293
|
-
cache_password = Rails.application.secrets.redis_cache_password
|
294
|
-
config.cache_store = :redis_cache_store, driver: :hiredis,
|
295
|
-
namespace: 'myapp-cache', compress: true, timeout: 1,
|
296
|
-
url: "redis://:#{cache_password}@myapp-cache-1:6379/0"
|
297
|
-
|
298
|
-
# Supports Redis::Distributed with multiple hosts
|
299
|
-
config.cache_store = :redis_cache_store, driver: :hiredis
|
300
|
-
namespace: 'myapp-cache', compress: true,
|
301
|
-
url: %w[
|
302
|
-
redis://myapp-cache-1:6379/0
|
303
|
-
redis://myapp-cache-1:6380/0
|
304
|
-
redis://myapp-cache-2:6379/0
|
305
|
-
redis://myapp-cache-2:6380/0
|
306
|
-
redis://myapp-cache-3:6379/0
|
307
|
-
redis://myapp-cache-3:6380/0
|
308
|
-
]
|
309
|
-
|
310
|
-
# Or pass a builder block
|
311
|
-
config.cache_store = :redis_cache_store,
|
312
|
-
namespace: 'myapp-cache', compress: true,
|
313
|
-
redis: -> { Redis.new … }
|
314
|
-
```
|
64
|
+
*Yoshiyuki Kinjo*
|
315
65
|
|
316
|
-
|
317
|
-
|
318
|
-
with mixed usage patterns and it won't expire cache entries by default.
|
66
|
+
* Rename `Module#parent`, `Module#parents`, and `Module#parent_name` to
|
67
|
+
`module_parent`, `module_parents`, and `module_parent_name`.
|
319
68
|
|
320
|
-
|
69
|
+
*Gannon McGibbon*
|
321
70
|
|
322
|
-
|
71
|
+
* Deprecate the use of `LoggerSilence` in favor of `ActiveSupport::LoggerSilence`
|
323
72
|
|
324
|
-
*
|
73
|
+
*Edouard Chin*
|
325
74
|
|
326
|
-
|
327
|
-
It wasn't enabled by default due to CPU cost. Today it's cheap and typical
|
328
|
-
cache data is eminently compressible, such as HTML or JSON fragments.
|
329
|
-
Compression dramatically reduces Memcached/Redis mem usage, which means
|
330
|
-
the same cache servers can store more data, which means higher hit rates.
|
75
|
+
* Deprecate using negative limits in `String#first` and `String#last`.
|
331
76
|
|
332
|
-
|
77
|
+
*Gannon McGibbon*, *Eric Turner*
|
333
78
|
|
334
|
-
|
79
|
+
* Fix bug where `#without` for `ActiveSupport::HashWithIndifferentAccess` would fail
|
80
|
+
with symbol arguments
|
335
81
|
|
336
|
-
*
|
82
|
+
*Abraham Chan*
|
337
83
|
|
338
|
-
|
339
|
-
|
340
|
-
stopped working with both Time ranges and TWZ ranges. However in
|
341
|
-
ruby/ruby@b061634 support was added for `include?` to use `cover?`
|
342
|
-
for 'linear' objects. Since we have no way of making Ruby consider
|
343
|
-
TWZ instances as 'linear' we have to override `Range#include?`.
|
84
|
+
* Treat `#delete_prefix`, `#delete_suffix` and `#unicode_normalize` results as non-`html_safe`.
|
85
|
+
Ensure safety of arguments for `#insert`, `#[]=` and `#replace` calls on `html_safe` Strings.
|
344
86
|
|
345
|
-
|
87
|
+
*Janosch Müller*
|
346
88
|
|
347
|
-
|
89
|
+
* Changed `ActiveSupport::TaggedLogging.new` to return a new logger instance instead
|
90
|
+
of mutating the one received as parameter.
|
348
91
|
|
349
|
-
*
|
92
|
+
*Thierry Joyal*
|
350
93
|
|
351
|
-
|
352
|
-
the match wasn't being lowercased before being looked up in the hash.
|
353
|
-
This shouldn't have any performance impact because before it would
|
354
|
-
fail to find the acronym and perform the `downcase` operation anyway.
|
94
|
+
* Define `unfreeze_time` as an alias of `travel_back` in `ActiveSupport::Testing::TimeHelpers`.
|
355
95
|
|
356
|
-
|
96
|
+
The alias is provided for symmetry with `freeze_time`.
|
357
97
|
|
358
|
-
*
|
98
|
+
*Ryan Davidson*
|
359
99
|
|
360
|
-
* Add
|
361
|
-
in accordance with `Date#prev_year`, `Date#next_year`.
|
100
|
+
* Add support for tracing constant autoloads. Just throw
|
362
101
|
|
363
|
-
|
102
|
+
ActiveSupport::Dependencies.logger = Rails.logger
|
103
|
+
ActiveSupport::Dependencies.verbose = true
|
364
104
|
|
365
|
-
|
366
|
-
```
|
367
|
-
Time.new(2017, 9, 16, 17, 0).prev_year # => 2016-09-16 17:00:00 +0300
|
368
|
-
Time.new(2017, 9, 16, 17, 0).prev_year(1)
|
369
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
105
|
+
in an initializer.
|
370
106
|
|
371
|
-
|
372
|
-
Time.new(2017, 9, 16, 17, 0).next_year(1)
|
373
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
374
|
-
```
|
107
|
+
*Xavier Noria*
|
375
108
|
|
376
|
-
|
377
|
-
```
|
378
|
-
Time.new(2017, 9, 16, 17, 0).prev_year # => 2016-09-16 17:00:00 +0300
|
379
|
-
Time.new(2017, 9, 16, 17, 0).prev_year(1) # => 2016-09-16 17:00:00 +0300
|
109
|
+
* Maintain `html_safe?` on html_safe strings when sliced.
|
380
110
|
|
381
|
-
|
382
|
-
|
383
|
-
```
|
111
|
+
string = "<div>test</div>".html_safe
|
112
|
+
string[-1..1].html_safe? # => true
|
384
113
|
|
385
|
-
*
|
114
|
+
*Elom Gomez*, *Yumin Wong*
|
386
115
|
|
387
|
-
* Add
|
388
|
-
in accordance with `Date#prev_month`, `Date#next_month`.
|
116
|
+
* Add `Array#extract!`.
|
389
117
|
|
390
|
-
|
118
|
+
The method removes and returns the elements for which the block returns a true value.
|
119
|
+
If no block is given, an Enumerator is returned instead.
|
391
120
|
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
Time.new(2017, 9, 16, 17, 0).prev_month(1)
|
396
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
397
|
-
|
398
|
-
Time.new(2017, 9, 16, 17, 0).next_month # => 2017-10-16 17:00:00 +0300
|
399
|
-
Time.new(2017, 9, 16, 17, 0).next_month(1)
|
400
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
401
|
-
```
|
402
|
-
|
403
|
-
After:
|
404
|
-
```
|
405
|
-
Time.new(2017, 9, 16, 17, 0).prev_month # => 2017-08-16 17:00:00 +0300
|
406
|
-
Time.new(2017, 9, 16, 17, 0).prev_month(1) # => 2017-08-16 17:00:00 +0300
|
407
|
-
|
408
|
-
Time.new(2017, 9, 16, 17, 0).next_month # => 2017-10-16 17:00:00 +0300
|
409
|
-
Time.new(2017, 9, 16, 17, 0).next_month(1) # => 2017-10-16 17:00:00 +0300
|
410
|
-
```
|
121
|
+
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
122
|
+
odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9]
|
123
|
+
numbers # => [0, 2, 4, 6, 8]
|
411
124
|
|
412
125
|
*bogdanvlviv*
|
413
126
|
|
414
|
-
*
|
415
|
-
in accordance with `Date#prev_day`, `Date#next_day`.
|
416
|
-
|
417
|
-
Allows pass argument for `Time#prev_day` and `Time#next_day`.
|
418
|
-
|
419
|
-
Before:
|
420
|
-
```
|
421
|
-
Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
|
422
|
-
Time.new(2017, 9, 16, 17, 0).prev_day(1)
|
423
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
424
|
-
|
425
|
-
Time.new(2017, 9, 16, 17, 0).next_day # => 2017-09-17 17:00:00 +0300
|
426
|
-
Time.new(2017, 9, 16, 17, 0).next_day(1)
|
427
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
428
|
-
```
|
429
|
-
|
430
|
-
After:
|
431
|
-
```
|
432
|
-
Time.new(2017, 9, 16, 17, 0).prev_day # => 2017-09-15 17:00:00 +0300
|
433
|
-
Time.new(2017, 9, 16, 17, 0).prev_day(1) # => 2017-09-15 17:00:00 +0300
|
434
|
-
|
435
|
-
Time.new(2017, 9, 16, 17, 0).next_day # => 2017-09-17 17:00:00 +0300
|
436
|
-
Time.new(2017, 9, 16, 17, 0).next_day(1) # => 2017-09-17 17:00:00 +0300
|
437
|
-
```
|
438
|
-
|
439
|
-
*bogdanvlviv*
|
440
|
-
|
441
|
-
* `IO#to_json` now returns the `to_s` representation, rather than
|
442
|
-
attempting to convert to an array. This fixes a bug where `IO#to_json`
|
443
|
-
would raise an `IOError` when called on an unreadable object.
|
444
|
-
|
445
|
-
Fixes #26132.
|
446
|
-
|
447
|
-
*Paul Kuruvilla*
|
448
|
-
|
449
|
-
* Remove deprecated `halt_callback_chains_on_return_false` option.
|
450
|
-
|
451
|
-
*Rafael Mendonça França*
|
452
|
-
|
453
|
-
* Remove deprecated `:if` and `:unless` string filter for callbacks.
|
454
|
-
|
455
|
-
*Rafael Mendonça França*
|
456
|
-
|
457
|
-
* `Hash#slice` now falls back to Ruby 2.5+'s built-in definition if defined.
|
127
|
+
* Support not to cache `nil` for `ActiveSupport::Cache#fetch`.
|
458
128
|
|
459
|
-
|
129
|
+
cache.fetch('bar', skip_nil: true) { nil }
|
130
|
+
cache.exist?('bar') # => false
|
460
131
|
|
461
|
-
*
|
132
|
+
*Martin Hong*
|
462
133
|
|
463
|
-
|
464
|
-
|
134
|
+
* Add "event object" support to the notification system.
|
135
|
+
Before this change, end users were forced to create hand made artisanal
|
136
|
+
event objects on their own, like this:
|
465
137
|
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
applications to `secret_key_base`.
|
138
|
+
ActiveSupport::Notifications.subscribe('wait') do |*args|
|
139
|
+
@event = ActiveSupport::Notifications::Event.new(*args)
|
140
|
+
end
|
470
141
|
|
471
|
-
|
142
|
+
ActiveSupport::Notifications.instrument('wait') do
|
143
|
+
sleep 1
|
144
|
+
end
|
472
145
|
|
473
|
-
|
146
|
+
@event.duration # => 1000.138
|
474
147
|
|
475
|
-
|
148
|
+
After this change, if the block passed to `subscribe` only takes one
|
149
|
+
parameter, the framework will yield an event object to the block. Now
|
150
|
+
end users are no longer required to make their own:
|
476
151
|
|
477
|
-
|
152
|
+
ActiveSupport::Notifications.subscribe('wait') do |event|
|
153
|
+
@event = event
|
154
|
+
end
|
478
155
|
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
for `MessageEncryptor` and the `verified` method for `MessageVerifier` also
|
483
|
-
accept an optional keyword argument `:on_rotation` block which is called
|
484
|
-
when a rotated instance is used to decrypt or verify the message.
|
156
|
+
ActiveSupport::Notifications.instrument('wait') do
|
157
|
+
sleep 1
|
158
|
+
end
|
485
159
|
|
486
|
-
|
160
|
+
p @event.allocations # => 7
|
161
|
+
p @event.cpu_time # => 0.256
|
162
|
+
p @event.idle_time # => 1003.2399
|
487
163
|
|
488
|
-
|
164
|
+
Now you can enjoy event objects without making them yourself. Neat!
|
489
165
|
|
490
|
-
*
|
491
|
-
|
492
|
-
* Add `config/credentials.yml.enc` to store production app secrets.
|
493
|
-
|
494
|
-
Allows saving any authentication credentials for third party services
|
495
|
-
directly in repo encrypted with `config/master.key` or `ENV["RAILS_MASTER_KEY"]`.
|
496
|
-
|
497
|
-
This will eventually replace `Rails.application.secrets` and the encrypted
|
498
|
-
secrets introduced in Rails 5.1.
|
499
|
-
|
500
|
-
*DHH*, *Kasper Timm Hansen*
|
501
|
-
|
502
|
-
* Add `ActiveSupport::EncryptedFile` and `ActiveSupport::EncryptedConfiguration`.
|
503
|
-
|
504
|
-
Allows for stashing encrypted files or configuration directly in repo by
|
505
|
-
encrypting it with a key.
|
166
|
+
*Aaron "t.lo" Patterson*
|
506
167
|
|
507
|
-
|
168
|
+
* Add cpu_time, idle_time, and allocations to Event.
|
508
169
|
|
509
|
-
*
|
170
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
510
171
|
|
511
|
-
*
|
512
|
-
similar to `Module#delegate`.
|
172
|
+
* RedisCacheStore: support key expiry in increment/decrement.
|
513
173
|
|
514
|
-
|
174
|
+
Pass `:expires_in` to `#increment` and `#decrement` to set a Redis EXPIRE on the key.
|
515
175
|
|
516
|
-
|
176
|
+
If the key is already set to expire, RedisCacheStore won't extend its expiry.
|
517
177
|
|
518
|
-
|
519
|
-
invalid option was passed as a parameter.
|
178
|
+
Rails.cache.increment("some_key", 1, expires_in: 2.minutes)
|
520
179
|
|
521
|
-
|
522
|
-
|
523
|
-
'one_two'.camelize(true)
|
524
|
-
# => nil
|
525
|
-
|
526
|
-
Now:
|
527
|
-
|
528
|
-
'one_two'.camelize(true)
|
529
|
-
# => ArgumentError: Invalid option, use either :upper or :lower.
|
180
|
+
*Jason Lee*
|
530
181
|
|
531
|
-
|
182
|
+
* Allow `Range#===` and `Range#cover?` on Range.
|
532
183
|
|
533
|
-
|
184
|
+
`Range#cover?` can now accept a range argument like `Range#include?` and
|
185
|
+
`Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
|
186
|
+
into a new file, with these two methods.
|
534
187
|
|
535
|
-
|
536
|
-
|
537
|
-
an expression. However, the implementation was missing support for modulo
|
538
|
-
operations. This support has now been added and should result in a duration
|
539
|
-
being returned from expressions involving modulo operations.
|
188
|
+
*Requiring active_support/core_ext/range/include_range is now deprecated.*
|
189
|
+
*Use `require "active_support/core_ext/range/compare_range"` instead.*
|
540
190
|
|
541
|
-
|
191
|
+
*utilum*
|
542
192
|
|
543
|
-
|
544
|
-
# => 60
|
193
|
+
* Add `index_with` to Enumerable.
|
545
194
|
|
546
|
-
|
195
|
+
Allows creating a hash from an enumerable with the value from a passed block
|
196
|
+
or a default argument.
|
547
197
|
|
548
|
-
|
549
|
-
# =>
|
198
|
+
%i( title body ).index_with { |attr| post.public_send(attr) }
|
199
|
+
# => { title: "hey", body: "what's up?" }
|
550
200
|
|
551
|
-
|
201
|
+
%i( title body ).index_with(nil)
|
202
|
+
# => { title: nil, body: nil }
|
552
203
|
|
553
|
-
|
204
|
+
Closely linked with `index_by`, which creates a hash where the keys are extracted from a block.
|
554
205
|
|
555
|
-
*
|
206
|
+
*Kasper Timm Hansen*
|
556
207
|
|
557
|
-
|
558
|
-
|
559
|
-
return a `Numeric`. The behavior of previous versions of Rails has been restored.
|
208
|
+
* Fix bug where `ActiveSupport::Timezone.all` would fail when tzinfo data for
|
209
|
+
any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
|
560
210
|
|
561
|
-
|
211
|
+
*Dominik Sander*
|
562
212
|
|
563
|
-
|
213
|
+
* Redis cache store: `delete_matched` no longer blocks the Redis server.
|
214
|
+
(Switches from evaled Lua to a batched SCAN + DEL loop.)
|
564
215
|
|
565
|
-
*
|
566
|
-
`ActiveSupport::MessageEncryptor`.
|
216
|
+
*Gleb Mazovetskiy*
|
567
217
|
|
568
|
-
|
218
|
+
* Fix bug where `ActiveSupport::Cache` will massively inflate the storage
|
219
|
+
size when compression is enabled (which is true by default). This patch
|
220
|
+
does not attempt to repair existing data: please manually flush the cache
|
221
|
+
to clear out the problematic entries.
|
569
222
|
|
570
|
-
|
223
|
+
*Godfrey Chan*
|
571
224
|
|
572
|
-
|
573
|
-
@verifier.verified(token) # => nil
|
225
|
+
* Fix bug where `URI.unescape` would fail with mixed Unicode/escaped character input:
|
574
226
|
|
575
|
-
|
227
|
+
URI.unescape("\xe3\x83\x90") # => "バ"
|
228
|
+
URI.unescape("%E3%83%90") # => "バ"
|
229
|
+
URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
|
576
230
|
|
577
|
-
|
578
|
-
@verifier.generate("y", expires_at: Time.now.end_of_year)
|
231
|
+
*Ashe Connor*, *Aaron Patterson*
|
579
232
|
|
580
|
-
|
581
|
-
`
|
233
|
+
* Add `before?` and `after?` methods to `Date`, `DateTime`,
|
234
|
+
`Time`, and `TimeWithZone`.
|
582
235
|
|
583
|
-
|
236
|
+
*Nick Holden*
|
584
237
|
|
585
|
-
|
238
|
+
* `ActiveSupport::Inflector#ordinal` and `ActiveSupport::Inflector#ordinalize` now support
|
239
|
+
translations through I18n.
|
586
240
|
|
587
|
-
|
241
|
+
# locale/fr.rb
|
588
242
|
|
589
|
-
|
243
|
+
{
|
244
|
+
fr: {
|
245
|
+
number: {
|
246
|
+
nth: {
|
247
|
+
ordinals: lambda do |_key, number:, **_options|
|
248
|
+
if number.to_i.abs == 1
|
249
|
+
'er'
|
250
|
+
else
|
251
|
+
'e'
|
252
|
+
end
|
253
|
+
end,
|
590
254
|
|
591
|
-
|
255
|
+
ordinalized: lambda do |_key, number:, **_options|
|
256
|
+
"#{number}#{ActiveSupport::Inflector.ordinal(number)}"
|
257
|
+
end
|
258
|
+
}
|
259
|
+
}
|
260
|
+
}
|
261
|
+
}
|
592
262
|
|
593
|
-
*Prathamesh Sonpatki*
|
594
263
|
|
595
|
-
*
|
264
|
+
*Christian Blais*
|
596
265
|
|
597
|
-
|
598
|
-
|
266
|
+
* Add `:private` option to ActiveSupport's `Module#delegate`
|
267
|
+
in order to delegate methods as private:
|
599
268
|
|
600
|
-
|
269
|
+
class User < ActiveRecord::Base
|
270
|
+
has_one :profile
|
271
|
+
delegate :date_of_birth, to: :profile, private: true
|
601
272
|
|
602
|
-
|
273
|
+
def age
|
274
|
+
Date.today.year - date_of_birth.year
|
275
|
+
end
|
276
|
+
end
|
603
277
|
|
604
|
-
|
278
|
+
# User.new.age # => 29
|
279
|
+
# User.new.date_of_birth
|
280
|
+
# => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340>
|
605
281
|
|
606
|
-
|
607
|
-
Keys that aren't found may be written to the cache store in one shot
|
608
|
-
instead of separate writes.
|
282
|
+
*Tomas Valent*
|
609
283
|
|
610
|
-
|
611
|
-
|
612
|
-
Redis `MSET`.
|
284
|
+
* `String#truncate_bytes` to truncate a string to a maximum bytesize without
|
285
|
+
breaking multibyte characters or grapheme clusters like 👩👩👦👦.
|
613
286
|
|
614
287
|
*Jeremy Daer*
|
615
288
|
|
616
|
-
*
|
617
|
-
|
618
|
-
mattr_accessor :settings, default: {}
|
619
|
-
|
620
|
-
Works for `mattr_reader`, `mattr_writer`, `cattr_accessor`, `cattr_reader`,
|
621
|
-
and `cattr_writer` as well.
|
622
|
-
|
623
|
-
*Genadi Samokovarov*
|
624
|
-
|
625
|
-
* Add `Date#prev_occurring` and `Date#next_occurring` to return specified next/previous occurring day of week.
|
626
|
-
|
627
|
-
*Shota Iguchi*
|
628
|
-
|
629
|
-
* Add default option to `class_attribute`.
|
630
|
-
|
631
|
-
Before:
|
632
|
-
|
633
|
-
class_attribute :settings
|
634
|
-
self.settings = {}
|
635
|
-
|
636
|
-
Now:
|
637
|
-
|
638
|
-
class_attribute :settings, default: {}
|
639
|
-
|
640
|
-
*DHH*
|
289
|
+
* `String#strip_heredoc` preserves frozenness.
|
641
290
|
|
642
|
-
|
291
|
+
"foo".freeze.strip_heredoc.frozen? # => true
|
643
292
|
|
644
|
-
|
293
|
+
Fixes that frozen string literals would inadvertently become unfrozen:
|
645
294
|
|
646
|
-
|
647
|
-
Primary use case is keeping all the per-request attributes easily available to the whole system.
|
295
|
+
# frozen_string_literal: true
|
648
296
|
|
649
|
-
|
297
|
+
foo = <<-MSG.strip_heredoc
|
298
|
+
la la la
|
299
|
+
MSG
|
650
300
|
|
651
|
-
|
301
|
+
foo.frozen? # => false !??
|
652
302
|
|
653
|
-
|
654
|
-
of seconds, but this causes issues with dates being converted to times, e.g:
|
655
|
-
|
656
|
-
Time.zone = "Beijing" # => Asia/Shanghai
|
657
|
-
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
|
658
|
-
2 * 1.day # => 172800 seconds
|
659
|
-
date + 2 * 1.day # => Mon, 22 May 2017 00:00:00 CST +08:00
|
660
|
-
|
661
|
-
Now, the `ActiveSupport::Duration::Scalar` calculation methods will try to maintain
|
662
|
-
the part structure of the duration where possible, e.g:
|
663
|
-
|
664
|
-
Time.zone = "Beijing" # => Asia/Shanghai
|
665
|
-
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
|
666
|
-
2 * 1.day # => 2 days
|
667
|
-
date + 2 * 1.day # => Mon, 22 May 2017
|
668
|
-
|
669
|
-
Fixes #29160, #28970.
|
670
|
-
|
671
|
-
*Andrew White*
|
672
|
-
|
673
|
-
* Add support for versioned cache entries. This enables the cache stores to recycle cache keys, greatly saving
|
674
|
-
on storage in cases with frequent churn. Works together with the separation of `#cache_key` and `#cache_version`
|
675
|
-
in Active Record and its use in Action Pack's fragment caching.
|
676
|
-
|
677
|
-
*DHH*
|
678
|
-
|
679
|
-
* Pass gem name and deprecation horizon to deprecation notifications.
|
680
|
-
|
681
|
-
*Willem van Bergen*
|
682
|
-
|
683
|
-
* Add support for `:offset` and `:zone` to `ActiveSupport::TimeWithZone#change`.
|
684
|
-
|
685
|
-
*Andrew White*
|
686
|
-
|
687
|
-
* Add support for `:offset` to `Time#change`.
|
303
|
+
*Jeremy Daer*
|
688
304
|
|
689
|
-
|
305
|
+
* Rails 6 requires Ruby 2.5.0 or newer.
|
690
306
|
|
691
|
-
*
|
307
|
+
*Jeremy Daer*, *Kasper Timm Hansen*
|
692
308
|
|
693
|
-
*
|
309
|
+
* Adds parallel testing to Rails.
|
694
310
|
|
695
|
-
|
311
|
+
Parallelize your test suite with forked processes or threads.
|
696
312
|
|
697
|
-
*
|
313
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
698
314
|
|
699
315
|
|
700
|
-
Please check [5-
|
316
|
+
Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/activesupport/CHANGELOG.md) for previous changes.
|