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