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