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