activesupport 5.2.5 → 6.0.4.1
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 +452 -398
- data/MIT-LICENSE +1 -1
- data/README.rdoc +4 -3
- data/lib/active_support/actionable_error.rb +48 -0
- data/lib/active_support/backtrace_cleaner.rb +27 -1
- data/lib/active_support/cache/file_store.rb +32 -32
- data/lib/active_support/cache/mem_cache_store.rb +12 -7
- data/lib/active_support/cache/memory_store.rb +15 -9
- data/lib/active_support/cache/null_store.rb +8 -3
- data/lib/active_support/cache/redis_cache_store.rb +47 -20
- data/lib/active_support/cache/strategy/local_cache.rb +22 -22
- data/lib/active_support/cache.rb +71 -48
- data/lib/active_support/callbacks.rb +16 -8
- data/lib/active_support/concern.rb +24 -1
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +18 -0
- data/lib/active_support/concurrency/share_lock.rb +0 -1
- data/lib/active_support/configurable.rb +7 -11
- data/lib/active_support/core_ext/array/access.rb +18 -6
- data/lib/active_support/core_ext/array/conversions.rb +5 -5
- data/lib/active_support/core_ext/array/extract.rb +21 -0
- data/lib/active_support/core_ext/array/prepend_and_append.rb +2 -6
- data/lib/active_support/core_ext/array.rb +1 -1
- data/lib/active_support/core_ext/class/attribute.rb +11 -16
- 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 -47
- data/lib/active_support/core_ext/date_and_time/zones.rb +0 -1
- data/lib/active_support/core_ext/date_time/calculations.rb +1 -1
- data/lib/active_support/core_ext/date_time/conversions.rb +0 -1
- data/lib/active_support/core_ext/enumerable.rb +97 -73
- data/lib/active_support/core_ext/hash/compact.rb +2 -26
- data/lib/active_support/core_ext/hash/conversions.rb +1 -1
- data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
- data/lib/active_support/core_ext/hash/except.rb +2 -2
- data/lib/active_support/core_ext/hash/keys.rb +0 -29
- data/lib/active_support/core_ext/hash/slice.rb +3 -25
- data/lib/active_support/core_ext/hash/transform_values.rb +2 -29
- data/lib/active_support/core_ext/hash.rb +1 -2
- data/lib/active_support/core_ext/integer/multiple.rb +1 -1
- data/lib/active_support/core_ext/kernel.rb +0 -1
- data/lib/active_support/core_ext/load_error.rb +1 -1
- data/lib/active_support/core_ext/module/attribute_accessors.rb +7 -10
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +13 -19
- data/lib/active_support/core_ext/module/delegation.rb +41 -8
- data/lib/active_support/core_ext/module/introspection.rb +38 -13
- data/lib/active_support/core_ext/module/reachable.rb +1 -6
- data/lib/active_support/core_ext/module/redefine_method.rb +8 -17
- data/lib/active_support/core_ext/module.rb +0 -1
- data/lib/active_support/core_ext/numeric/conversions.rb +124 -128
- data/lib/active_support/core_ext/numeric/inquiry.rb +2 -25
- data/lib/active_support/core_ext/numeric.rb +0 -1
- data/lib/active_support/core_ext/object/blank.rb +1 -2
- data/lib/active_support/core_ext/object/duplicable.rb +7 -114
- data/lib/active_support/core_ext/object/json.rb +2 -1
- data/lib/active_support/core_ext/object/try.rb +17 -7
- data/lib/active_support/core_ext/object/with_options.rb +1 -1
- data/lib/active_support/core_ext/range/compare_range.rb +28 -13
- data/lib/active_support/core_ext/range/conversions.rb +31 -29
- data/lib/active_support/core_ext/range/each.rb +0 -1
- data/lib/active_support/core_ext/range/include_range.rb +6 -0
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +2 -2
- 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 +42 -1
- data/lib/active_support/core_ext/string/inflections.rb +7 -2
- data/lib/active_support/core_ext/string/multibyte.rb +4 -3
- data/lib/active_support/core_ext/string/output_safety.rb +68 -10
- data/lib/active_support/core_ext/string/strip.rb +3 -1
- data/lib/active_support/core_ext/time/calculations.rb +34 -3
- data/lib/active_support/core_ext/uri.rb +1 -0
- data/lib/active_support/current_attributes.rb +8 -0
- data/lib/active_support/dependencies/zeitwerk_integration.rb +117 -0
- data/lib/active_support/dependencies.rb +74 -18
- data/lib/active_support/deprecation/behaviors.rb +1 -1
- data/lib/active_support/deprecation/method_wrappers.rb +17 -23
- data/lib/active_support/deprecation/proxy_wrappers.rb +28 -5
- data/lib/active_support/deprecation.rb +1 -1
- data/lib/active_support/descendants_tracker.rb +55 -9
- data/lib/active_support/duration/iso8601_parser.rb +2 -4
- data/lib/active_support/duration/iso8601_serializer.rb +3 -5
- data/lib/active_support/duration.rb +7 -8
- data/lib/active_support/encrypted_configuration.rb +0 -4
- data/lib/active_support/encrypted_file.rb +3 -2
- data/lib/active_support/evented_file_update_checker.rb +39 -10
- data/lib/active_support/execution_wrapper.rb +1 -0
- data/lib/active_support/file_update_checker.rb +0 -1
- data/lib/active_support/gem_version.rb +4 -4
- data/lib/active_support/hash_with_indifferent_access.rb +22 -18
- data/lib/active_support/i18n.rb +1 -0
- data/lib/active_support/i18n_railtie.rb +13 -1
- data/lib/active_support/inflector/inflections.rb +1 -5
- data/lib/active_support/inflector/methods.rb +16 -29
- data/lib/active_support/inflector/transliterate.rb +47 -18
- data/lib/active_support/json/decoding.rb +23 -24
- 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 -2
- data/lib/active_support/locale/en.rb +33 -0
- data/lib/active_support/log_subscriber.rb +31 -9
- data/lib/active_support/logger.rb +1 -16
- data/lib/active_support/logger_silence.rb +28 -12
- data/lib/active_support/logger_thread_safe_level.rb +26 -4
- data/lib/active_support/message_encryptor.rb +4 -6
- data/lib/active_support/message_verifier.rb +5 -5
- data/lib/active_support/messages/metadata.rb +11 -2
- data/lib/active_support/messages/rotator.rb +4 -4
- data/lib/active_support/multibyte/chars.rb +29 -49
- data/lib/active_support/multibyte/unicode.rb +44 -282
- data/lib/active_support/notifications/fanout.rb +98 -13
- data/lib/active_support/notifications/instrumenter.rb +80 -9
- data/lib/active_support/notifications.rb +41 -4
- data/lib/active_support/number_helper/number_converter.rb +4 -5
- data/lib/active_support/number_helper/number_to_currency_converter.rb +4 -9
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +3 -2
- data/lib/active_support/number_helper/number_to_human_converter.rb +3 -2
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +3 -2
- 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 -1
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +5 -4
- data/lib/active_support/number_helper/rounding_helper.rb +1 -1
- data/lib/active_support/number_helper.rb +11 -0
- data/lib/active_support/option_merger.rb +21 -3
- data/lib/active_support/ordered_hash.rb +1 -1
- data/lib/active_support/ordered_options.rb +5 -1
- data/lib/active_support/parameter_filter.rb +128 -0
- data/lib/active_support/rails.rb +0 -6
- data/lib/active_support/reloader.rb +4 -5
- data/lib/active_support/security_utils.rb +1 -1
- data/lib/active_support/string_inquirer.rb +0 -1
- data/lib/active_support/subscriber.rb +65 -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 +134 -0
- data/lib/active_support/testing/stream.rb +1 -2
- data/lib/active_support/testing/time_helpers.rb +7 -9
- data/lib/active_support/time_with_zone.rb +15 -5
- data/lib/active_support/values/time_zone.rb +12 -7
- data/lib/active_support/xml_mini/jdom.rb +2 -3
- data/lib/active_support/xml_mini/libxml.rb +2 -2
- data/lib/active_support/xml_mini/libxmlsax.rb +4 -4
- data/lib/active_support/xml_mini/nokogiri.rb +2 -2
- data/lib/active_support/xml_mini/nokogirisax.rb +3 -3
- data/lib/active_support/xml_mini/rexml.rb +2 -2
- data/lib/active_support/xml_mini.rb +2 -10
- data/lib/active_support.rb +2 -1
- metadata +40 -12
- data/lib/active_support/core_ext/kernel/agnostics.rb +0 -13
- data/lib/active_support/values/unicode_tables.dat +0 -0
data/CHANGELOG.md
CHANGED
@@ -1,35 +1,157 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 6.0.4.1 (August 19, 2021) ##
|
2
2
|
|
3
3
|
* No changes.
|
4
4
|
|
5
5
|
|
6
|
-
## Rails
|
6
|
+
## Rails 6.0.4 (June 15, 2021) ##
|
7
|
+
|
8
|
+
* Fixed issue in `ActiveSupport::Cache::RedisCacheStore` not passing options
|
9
|
+
to `read_multi` causing `fetch_multi` to not work properly.
|
10
|
+
|
11
|
+
*Rajesh Sharma*
|
12
|
+
|
13
|
+
* `with_options` copies its options hash again to avoid leaking mutations.
|
14
|
+
|
15
|
+
Fixes #39343.
|
16
|
+
|
17
|
+
*Eugene Kenny*
|
18
|
+
|
19
|
+
|
20
|
+
## Rails 6.0.3.7 (May 05, 2021) ##
|
21
|
+
|
22
|
+
* No changes.
|
23
|
+
|
24
|
+
|
25
|
+
## Rails 6.0.3.6 (March 26, 2021) ##
|
26
|
+
|
27
|
+
* No changes.
|
28
|
+
|
29
|
+
|
30
|
+
## Rails 6.0.3.5 (February 10, 2021) ##
|
7
31
|
|
8
32
|
* No changes.
|
9
33
|
|
10
34
|
|
11
|
-
## Rails
|
35
|
+
## Rails 6.0.3.4 (October 07, 2020) ##
|
12
36
|
|
13
37
|
* No changes.
|
14
38
|
|
15
39
|
|
16
|
-
## Rails
|
40
|
+
## Rails 6.0.3.3 (September 09, 2020) ##
|
41
|
+
|
42
|
+
* No changes.
|
43
|
+
|
44
|
+
|
45
|
+
## Rails 6.0.3.2 (June 17, 2020) ##
|
46
|
+
|
47
|
+
* No changes.
|
48
|
+
|
49
|
+
|
50
|
+
## Rails 6.0.3.1 (May 18, 2020) ##
|
17
51
|
|
18
52
|
* [CVE-2020-8165] Deprecate Marshal.load on raw cache read in RedisCacheStore
|
19
53
|
|
20
54
|
* [CVE-2020-8165] Avoid Marshal.load on raw cache value in MemCacheStore
|
21
55
|
|
22
|
-
|
56
|
+
|
57
|
+
## Rails 6.0.3 (May 06, 2020) ##
|
58
|
+
|
59
|
+
* `Array#to_sentence` no longer returns a frozen string.
|
60
|
+
|
61
|
+
Before:
|
62
|
+
|
63
|
+
['one', 'two'].to_sentence.frozen?
|
64
|
+
# => true
|
65
|
+
|
66
|
+
After:
|
67
|
+
|
68
|
+
['one', 'two'].to_sentence.frozen?
|
69
|
+
# => false
|
70
|
+
|
71
|
+
*Nicolas Dular*
|
72
|
+
|
73
|
+
* Update `ActiveSupport::Messages::Metadata#fresh?` to work for cookies with expiry set when
|
74
|
+
`ActiveSupport.parse_json_times = true`.
|
75
|
+
|
76
|
+
*Christian Gregg*
|
77
|
+
|
78
|
+
|
79
|
+
## Rails 6.0.2.2 (March 19, 2020) ##
|
23
80
|
|
24
81
|
* No changes.
|
25
82
|
|
26
83
|
|
27
|
-
## Rails
|
84
|
+
## Rails 6.0.2.1 (December 18, 2019) ##
|
28
85
|
|
29
86
|
* No changes.
|
30
87
|
|
31
88
|
|
32
|
-
## Rails
|
89
|
+
## Rails 6.0.2 (December 13, 2019) ##
|
90
|
+
|
91
|
+
* Eager load translations during initialization.
|
92
|
+
|
93
|
+
*Diego Plentz*
|
94
|
+
|
95
|
+
* Use per-thread CPU time clock on `ActiveSupport::Notifications`.
|
96
|
+
|
97
|
+
*George Claghorn*
|
98
|
+
|
99
|
+
|
100
|
+
## Rails 6.0.1 (November 5, 2019) ##
|
101
|
+
|
102
|
+
* `ActiveSupport::SafeBuffer` supports `Enumerator` methods.
|
103
|
+
|
104
|
+
*Shugo Maeda*
|
105
|
+
|
106
|
+
* The Redis cache store fails gracefully when the server returns a "max number
|
107
|
+
of clients reached" error.
|
108
|
+
|
109
|
+
*Brandon Medenwald*
|
110
|
+
|
111
|
+
* Fixed that mutating a value returned by a memory cache store would
|
112
|
+
unexpectedly change the cached value.
|
113
|
+
|
114
|
+
*Jonathan Hyman*
|
115
|
+
|
116
|
+
* The default inflectors in `zeitwerk` mode support overrides:
|
117
|
+
|
118
|
+
```ruby
|
119
|
+
# config/initializers/zeitwerk.rb
|
120
|
+
Rails.autoloaders.each do |autoloader|
|
121
|
+
autoloader.inflector.inflect(
|
122
|
+
"html_parser" => "HTMLParser",
|
123
|
+
"ssl_error" => "SSLError"
|
124
|
+
)
|
125
|
+
end
|
126
|
+
```
|
127
|
+
|
128
|
+
That way, you can tweak how individual basenames are inflected without touching Active Support inflection rules, which are global. These inflectors fallback to `String#camelize`, so existing inflection rules are still taken into account for non-overridden basenames.
|
129
|
+
|
130
|
+
Please, check the [autoloading guide for `zeitwerk` mode](https://guides.rubyonrails.org/v6.0/autoloading_and_reloading_constants.html#customizing-inflections) if you prefer not to depend on `String#camelize` at all.
|
131
|
+
|
132
|
+
*Xavier Noria*
|
133
|
+
|
134
|
+
* Improve `Range#===`, `Range#include?`, and `Range#cover?` to work with beginless (startless)
|
135
|
+
and endless range targets.
|
136
|
+
|
137
|
+
*Allen Hsu*, *Andrew Hodgkinson*
|
138
|
+
|
139
|
+
* Don't use `Process#clock_gettime(CLOCK_THREAD_CPUTIME_ID)` on Solaris.
|
140
|
+
|
141
|
+
*Iain Beeston*
|
142
|
+
|
143
|
+
|
144
|
+
## Rails 6.0.0 (August 16, 2019) ##
|
145
|
+
|
146
|
+
* Let `require_dependency` in `zeitwerk` mode look the autoload paths up for
|
147
|
+
better backwards compatibility.
|
148
|
+
|
149
|
+
*Xavier Noria*
|
150
|
+
|
151
|
+
* Let `require_dependency` in `zeitwerk` mode support arguments that respond
|
152
|
+
to `to_path` for better backwards compatibility.
|
153
|
+
|
154
|
+
*Xavier Noria*
|
33
155
|
|
34
156
|
* Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
|
35
157
|
|
@@ -63,606 +185,538 @@
|
|
63
185
|
|
64
186
|
*Alexander Varnin*
|
65
187
|
|
188
|
+
* Do not delegate missing `marshal_dump` and `_dump` methods via the
|
189
|
+
`delegate_missing_to` extension. This avoids unintentionally adding instance
|
190
|
+
variables when calling `Marshal.dump(object)`, should the delegation target of
|
191
|
+
`object` be a method which would otherwise add them. Fixes #36522.
|
66
192
|
|
67
|
-
|
68
|
-
|
69
|
-
* Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
|
193
|
+
*Aaron Lipman*
|
70
194
|
|
71
|
-
`assoc` can now be called with either a string or a symbol.
|
72
195
|
|
73
|
-
|
196
|
+
## Rails 6.0.0.rc2 (July 22, 2019) ##
|
74
197
|
|
75
|
-
*
|
198
|
+
* `truncate` would return the original string if it was too short to be truncated
|
199
|
+
and a frozen string if it were long enough to be truncated. Now truncate will
|
200
|
+
consistently return an unfrozen string regardless. This behavior is consistent
|
201
|
+
with `gsub` and `strip`.
|
76
202
|
|
77
|
-
|
203
|
+
Before:
|
78
204
|
|
79
|
-
|
205
|
+
'foobar'.truncate(5).frozen?
|
206
|
+
# => true
|
207
|
+
'foobar'.truncate(6).frozen?
|
208
|
+
# => false
|
80
209
|
|
81
|
-
|
82
|
-
`Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
|
83
|
-
into a new file, with these two methods.
|
210
|
+
After:
|
84
211
|
|
85
|
-
|
212
|
+
'foobar'.truncate(5).frozen?
|
213
|
+
# => false
|
214
|
+
'foobar'.truncate(6).frozen?
|
215
|
+
# => false
|
86
216
|
|
87
|
-
*
|
217
|
+
*Jordan Thomas*
|
88
218
|
|
89
|
-
*Mark J. Titorenko*, *Vlad Bokov*
|
90
219
|
|
220
|
+
## Rails 6.0.0.rc1 (April 24, 2019) ##
|
91
221
|
|
92
|
-
|
222
|
+
* Speed improvements to `Hash.except` and `HashWithIndifferentAccess#except`.
|
93
223
|
|
94
|
-
|
224
|
+
These methods now unset the `default`/`default_proc` on the returned Hash, compatible with Ruby 3.0’s native implementation.
|
95
225
|
|
226
|
+
*Timo Schilling*
|
96
227
|
|
97
|
-
|
228
|
+
* Introduce `ActiveSupport::ActionableError`.
|
98
229
|
|
99
|
-
|
100
|
-
|
230
|
+
Actionable errors let's you dispatch actions from Rails' error pages. This
|
231
|
+
can help you save time if you have a clear action for the resolution of
|
232
|
+
common development errors.
|
101
233
|
|
102
|
-
|
234
|
+
The de-facto example are pending migrations. Every time pending migrations
|
235
|
+
are found, a middleware raises an error. With actionable errors, you can
|
236
|
+
run the migrations right from the error page. Other examples include Rails
|
237
|
+
plugins that need to run a rake task to setup themselves. They can now
|
238
|
+
raise actionable errors to run the setup straight from the error pages.
|
103
239
|
|
104
|
-
|
240
|
+
Here is how to define an actionable error:
|
105
241
|
|
106
|
-
|
242
|
+
```ruby
|
243
|
+
class PendingMigrationError < MigrationError #:nodoc:
|
244
|
+
include ActiveSupport::ActionableError
|
107
245
|
|
108
|
-
|
246
|
+
action "Run pending migrations" do
|
247
|
+
ActiveRecord::Tasks::DatabaseTasks.migrate
|
248
|
+
end
|
249
|
+
end
|
250
|
+
```
|
109
251
|
|
110
|
-
|
111
|
-
|
112
|
-
|
252
|
+
To make an error actionable, include the `ActiveSupport::ActionableError`
|
253
|
+
module and invoke the `action` class macro to define the action. An action
|
254
|
+
needs a name and a procedure to execute. The name is shown as the name of a
|
255
|
+
button on the error pages. Once clicked, it will invoke the given
|
256
|
+
procedure.
|
113
257
|
|
114
|
-
*
|
258
|
+
*Vipul A M*, *Yao Jie*, *Genadi Samokovarov*
|
115
259
|
|
260
|
+
* Preserve `html_safe?` status on `ActiveSupport::SafeBuffer#*`.
|
116
261
|
|
117
|
-
|
262
|
+
Before:
|
118
263
|
|
119
|
-
*
|
264
|
+
("<br />".html_safe * 2).html_safe? #=> nil
|
120
265
|
|
266
|
+
After:
|
121
267
|
|
122
|
-
|
268
|
+
("<br />".html_safe * 2).html_safe? #=> true
|
123
269
|
|
124
|
-
*
|
125
|
-
(Switches from evaled Lua to a batched SCAN + DEL loop.)
|
270
|
+
*Ryo Nakamura*
|
126
271
|
|
127
|
-
|
272
|
+
* Calling test methods with `with_info_handler` method to allow minitest-hooks
|
273
|
+
plugin to work.
|
128
274
|
|
129
|
-
*
|
130
|
-
any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
|
275
|
+
*Mauri Mustonen*
|
131
276
|
|
132
|
-
|
277
|
+
* The Zeitwerk compatibility interface for `ActiveSupport::Dependencies` no
|
278
|
+
longer implements `autoloaded_constants` or `autoloaded?` (undocumented,
|
279
|
+
anyway). Experience shows introspection does not have many use cases, and
|
280
|
+
troubleshooting is done by logging. With this design trade-off we are able
|
281
|
+
to use even less memory in all environments.
|
133
282
|
|
134
|
-
*
|
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.
|
283
|
+
*Xavier Noria*
|
138
284
|
|
139
|
-
|
285
|
+
* Depends on Zeitwerk 2, which stores less metadata if reloading is disabled
|
286
|
+
and hence uses less memory when `config.cache_classes` is `true`, a standard
|
287
|
+
setup in production.
|
140
288
|
|
141
|
-
*
|
142
|
-
returning instances of `ActiveSupport::Cache::Entry` instead of the raw values.
|
289
|
+
*Xavier Noria*
|
143
290
|
|
144
|
-
|
291
|
+
* In `:zeitwerk` mode, eager load directories in engines and applications only
|
292
|
+
if present in their respective `config.eager_load_paths`.
|
145
293
|
|
294
|
+
A common use case for this is adding `lib` to `config.autoload_paths`, but
|
295
|
+
not to `config.eager_load_paths`. In that configuration, for example, files
|
296
|
+
in the `lib` directory should not be eager loaded.
|
146
297
|
|
147
|
-
|
298
|
+
*Xavier Noria*
|
148
299
|
|
149
|
-
*
|
150
|
-
Read from the local in-memory cache before consulting the backend.
|
300
|
+
* Fix bug in Range comparisons when comparing to an excluded-end Range
|
151
301
|
|
152
|
-
|
302
|
+
Before:
|
153
303
|
|
154
|
-
|
304
|
+
(1..10).cover?(1...11) # => false
|
155
305
|
|
156
|
-
|
157
|
-
`ActiveSupport::TimeZone::MAPPING` so return all of them instead
|
158
|
-
of the first one found by using `Hash#value`. e.g:
|
306
|
+
After:
|
159
307
|
|
160
|
-
#
|
161
|
-
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh"]
|
308
|
+
(1..10).cover?(1...11) # => true
|
162
309
|
|
163
|
-
|
164
|
-
ActiveSupport::TimeZone.country_zones("GB") # => ["Edinburgh", "London"]
|
310
|
+
With the same change for `Range#include?` and `Range#===`.
|
165
311
|
|
166
|
-
|
312
|
+
*Owen Stephens*
|
167
313
|
|
168
|
-
|
314
|
+
* Use weak references in descendants tracker to allow anonymous subclasses to
|
315
|
+
be garbage collected.
|
169
316
|
|
170
|
-
*
|
317
|
+
*Edgars Beigarts*
|
171
318
|
|
172
|
-
|
319
|
+
* Update `ActiveSupport::Notifications::Instrumenter#instrument` to make
|
320
|
+
passing a block optional. This will let users use
|
321
|
+
`ActiveSupport::Notifications` messaging features outside of
|
322
|
+
instrumentation.
|
173
323
|
|
174
|
-
*
|
175
|
-
numeric differences in the same assertion.
|
324
|
+
*Ali Ibrahim*
|
176
325
|
|
177
|
-
|
326
|
+
* Fix `Time#advance` to work with dates before 1001-03-07
|
178
327
|
|
179
|
-
|
328
|
+
Before:
|
180
329
|
|
181
|
-
|
330
|
+
Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-05 00:00:00 UTC
|
182
331
|
|
183
|
-
|
332
|
+
After
|
184
333
|
|
185
|
-
|
186
|
-
regardless of `from:` and `to:` argument combinations.
|
334
|
+
Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-06 00:00:00 UTC
|
187
335
|
|
188
|
-
|
336
|
+
Note that this doesn't affect `DateTime#advance` as that doesn't use a proleptic calendar.
|
189
337
|
|
190
|
-
*
|
338
|
+
*Andrew White*
|
191
339
|
|
192
|
-
|
193
|
-
`config.active_support.use_sha1_digests = true`.
|
340
|
+
* In Zeitwerk mode, engines are now managed by the `main` autoloader. Engines may reference application constants, if the application is reloaded and we do not reload engines, they won't use the reloaded application code.
|
194
341
|
|
195
|
-
*
|
342
|
+
*Xavier Noria*
|
196
343
|
|
197
|
-
*
|
198
|
-
to make it not leak length information even for variable length string.
|
344
|
+
* Add support for supplying `locale` to `transliterate` and `parameterize`.
|
199
345
|
|
200
|
-
|
201
|
-
and started raising `ArgumentError` in case of length mismatch of passed strings.
|
346
|
+
I18n.backend.store_translations(:de, i18n: { transliterate: { rule: { "ü" => "ue" } } })
|
202
347
|
|
203
|
-
|
348
|
+
ActiveSupport::Inflector.transliterate("ü", locale: :de) # => "ue"
|
349
|
+
"Fünf autos".parameterize(locale: :de) # => "fuenf-autos"
|
350
|
+
ActiveSupport::Inflector.parameterize("Fünf autos", locale: :de) # => "fuenf-autos"
|
204
351
|
|
205
|
-
*
|
206
|
-
`ActiveSupport::TimeZone::MAPPING`.
|
352
|
+
*Kaan Ozkan*, *Sharang Dashputre*
|
207
353
|
|
208
|
-
|
354
|
+
* Allow `Array#excluding` and `Enumerable#excluding` to deal with a passed array gracefully.
|
209
355
|
|
210
|
-
|
356
|
+
[ 1, 2, 3, 4, 5 ].excluding([4, 5]) # => [ 1, 2, 3 ]
|
211
357
|
|
212
|
-
*
|
358
|
+
*DHH*
|
213
359
|
|
214
|
-
|
215
|
-
|
216
|
-
If the counter exists, Memcached doesn't extend its expiry when it's
|
217
|
-
incremented or decremented.
|
360
|
+
* Renamed `Array#without` and `Enumerable#without` to `Array#excluding` and `Enumerable#excluding`, to create parity with
|
361
|
+
`Array#including` and `Enumerable#including`. Retained the old names as aliases.
|
218
362
|
|
219
|
-
|
220
|
-
Rails.cache.increment("my_counter", 1, expires_in: 2.minutes)
|
221
|
-
```
|
222
|
-
|
223
|
-
*Takumasa Ochi*
|
363
|
+
*DHH*
|
224
364
|
|
225
|
-
*
|
365
|
+
* Added `Array#including` and `Enumerable#including` to conveniently enlarge a collection with more members using a method rather than an operator:
|
226
366
|
|
227
|
-
|
228
|
-
|
367
|
+
[ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ]
|
368
|
+
post.authors.including(Current.person) # => All the authors plus the current person!
|
229
369
|
|
230
|
-
|
231
|
-
```
|
232
|
-
ENV["TZ"] = "Europe/Moscow"
|
233
|
-
Time.local(2014, 10, 26, 1, 0, 0) # => 2014-10-26 01:00:00 +0300
|
234
|
-
```
|
370
|
+
*DHH*
|
235
371
|
|
236
|
-
Before:
|
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
|
-
```
|
241
372
|
|
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
|
-
```
|
373
|
+
## Rails 6.0.0.beta3 (March 11, 2019) ##
|
247
374
|
|
248
|
-
|
375
|
+
* No changes.
|
249
376
|
|
250
|
-
*Andrew White*
|
251
377
|
|
252
|
-
|
378
|
+
## Rails 6.0.0.beta2 (February 25, 2019) ##
|
253
379
|
|
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
|
-
```
|
380
|
+
* New autoloading based on [Zeitwerk](https://github.com/fxn/zeitwerk).
|
283
381
|
|
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.
|
382
|
+
*Xavier Noria*
|
287
383
|
|
288
|
-
|
384
|
+
* Revise `ActiveSupport::Notifications.unsubscribe` to correctly handle Regex or other multiple-pattern subscribers.
|
289
385
|
|
290
|
-
*
|
386
|
+
*Zach Kemp*
|
291
387
|
|
292
|
-
*
|
388
|
+
* Add `before_reset` callback to `CurrentAttributes` and define `after_reset` as an alias of `resets` for symmetry.
|
293
389
|
|
294
|
-
|
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.
|
390
|
+
*Rosa Gutierrez*
|
299
391
|
|
300
|
-
|
392
|
+
* Remove the `` Kernel#` `` override that suppresses ENOENT and accidentally returns nil on Unix systems.
|
301
393
|
|
302
|
-
*
|
394
|
+
*Akinori Musha*
|
303
395
|
|
304
|
-
*
|
396
|
+
* Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
|
305
397
|
|
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?`.
|
398
|
+
`assoc` can now be called with either a string or a symbol.
|
312
399
|
|
313
|
-
|
400
|
+
*Stefan Schüßler*
|
314
401
|
|
315
|
-
|
402
|
+
* Add `Hash#deep_transform_values`, and `Hash#deep_transform_values!`.
|
316
403
|
|
317
|
-
*
|
404
|
+
*Guillermo Iguaran*
|
318
405
|
|
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
406
|
|
324
|
-
|
407
|
+
## Rails 6.0.0.beta1 (January 18, 2019) ##
|
325
408
|
|
326
|
-
|
409
|
+
* Remove deprecated `Module#reachable?` method.
|
327
410
|
|
328
|
-
*
|
329
|
-
in accordance with `Date#prev_year`, `Date#next_year`.
|
411
|
+
*Rafael Mendonça França*
|
330
412
|
|
331
|
-
|
413
|
+
* Remove deprecated `#acronym_regex` method from `Inflections`.
|
332
414
|
|
333
|
-
|
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)
|
415
|
+
*Rafael Mendonça França*
|
338
416
|
|
339
|
-
|
340
|
-
Time.new(2017, 9, 16, 17, 0).next_year(1)
|
341
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
342
|
-
```
|
417
|
+
* Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
|
343
418
|
|
344
|
-
|
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
|
419
|
+
*Keenan Brock*
|
348
420
|
|
349
|
-
|
350
|
-
Time.new(2017, 9, 16, 17, 0).next_year(1) # => 2018-09-16 17:00:00 +0300
|
351
|
-
```
|
421
|
+
* Preserve key order passed to `ActiveSupport::CacheStore#fetch_multi`.
|
352
422
|
|
353
|
-
*
|
423
|
+
`fetch_multi(*names)` now returns its results in the same order as the `*names` requested, rather than returning cache hits followed by cache misses.
|
354
424
|
|
355
|
-
*
|
356
|
-
in accordance with `Date#prev_month`, `Date#next_month`.
|
425
|
+
*Gannon McGibbon*
|
357
426
|
|
358
|
-
|
427
|
+
* If the same block is `included` multiple times for a Concern, an exception is no longer raised.
|
359
428
|
|
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)
|
429
|
+
*Mark J. Titorenko*, *Vlad Bokov*
|
365
430
|
|
366
|
-
|
367
|
-
|
368
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
369
|
-
```
|
431
|
+
* Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
|
432
|
+
would not act as alias for `#symbolize_keys`.
|
370
433
|
|
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
|
434
|
+
*Nick Weiland*
|
375
435
|
|
376
|
-
|
377
|
-
Time.new(2017, 9, 16, 17, 0).next_month(1) # => 2017-10-16 17:00:00 +0300
|
378
|
-
```
|
436
|
+
* Improve the logic that detects non-autoloaded constants.
|
379
437
|
|
380
|
-
*
|
438
|
+
*Jan Habermann*, *Xavier Noria*
|
381
439
|
|
382
|
-
*
|
383
|
-
in
|
440
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#pack_graphemes(array)` and `ActiveSupport::Multibyte::Unicode#unpack_graphemes(string)`
|
441
|
+
in favor of `array.flatten.pack("U*")` and `string.scan(/\X/).map(&:codepoints)`, respectively.
|
384
442
|
|
385
|
-
|
443
|
+
*Francesco Rodríguez*
|
386
444
|
|
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)
|
445
|
+
* Deprecate `ActiveSupport::Multibyte::Chars.consumes?` in favor of `String#is_utf8?`.
|
392
446
|
|
393
|
-
|
394
|
-
Time.new(2017, 9, 16, 17, 0).next_day(1)
|
395
|
-
# => ArgumentError: wrong number of arguments (given 1, expected 0)
|
396
|
-
```
|
447
|
+
*Francesco Rodríguez*
|
397
448
|
|
398
|
-
|
449
|
+
* Fix duration being rounded to a full second.
|
399
450
|
```
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
Time.new(2017, 9, 16, 17, 0).next_day # => 2017-09-17 17:00:00 +0300
|
404
|
-
Time.new(2017, 9, 16, 17, 0).next_day(1) # => 2017-09-17 17:00:00 +0300
|
451
|
+
time = DateTime.parse("2018-1-1")
|
452
|
+
time += 0.51.seconds
|
405
453
|
```
|
454
|
+
Will now correctly add 0.51 second and not 1 full second.
|
406
455
|
|
407
|
-
*
|
408
|
-
|
409
|
-
* `IO#to_json` now returns the `to_s` representation, rather than
|
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.
|
456
|
+
*Edouard Chin*
|
418
457
|
|
419
|
-
|
420
|
-
|
421
|
-
* Remove deprecated `:if` and `:unless` string filter for callbacks.
|
458
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#normalize` and `ActiveSupport::Multibyte::Chars#normalize`
|
459
|
+
in favor of `String#unicode_normalize`
|
422
460
|
|
423
|
-
*
|
461
|
+
*Francesco Rodríguez*
|
424
462
|
|
425
|
-
* `
|
463
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#downcase/upcase/swapcase` in favor of
|
464
|
+
`String#downcase/upcase/swapcase`.
|
426
465
|
|
427
|
-
*
|
466
|
+
*Francesco Rodríguez*
|
428
467
|
|
429
|
-
*
|
468
|
+
* Add `ActiveSupport::ParameterFilter`.
|
430
469
|
|
431
|
-
|
432
|
-
when the default changed from using `secret_token` to `secret_key_base`.
|
470
|
+
*Yoshiyuki Kinjo*
|
433
471
|
|
434
|
-
|
435
|
-
|
436
|
-
Deprecation warnings have been added to help developers upgrade their
|
437
|
-
applications to `secret_key_base`.
|
472
|
+
* Rename `Module#parent`, `Module#parents`, and `Module#parent_name` to
|
473
|
+
`module_parent`, `module_parents`, and `module_parent_name`.
|
438
474
|
|
439
|
-
*
|
475
|
+
*Gannon McGibbon*
|
440
476
|
|
441
|
-
*
|
477
|
+
* Deprecate the use of `LoggerSilence` in favor of `ActiveSupport::LoggerSilence`
|
442
478
|
|
443
|
-
*
|
479
|
+
*Edouard Chin*
|
444
480
|
|
445
|
-
*
|
481
|
+
* Deprecate using negative limits in `String#first` and `String#last`.
|
446
482
|
|
447
|
-
|
448
|
-
`MessageVerifier` classes. This method accepts the same arguments and
|
449
|
-
options as the given classes' constructor. The `encrypt_and_verify` method
|
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.
|
483
|
+
*Gannon McGibbon*, *Eric Turner*
|
453
484
|
|
454
|
-
|
485
|
+
* Fix bug where `#without` for `ActiveSupport::HashWithIndifferentAccess` would fail
|
486
|
+
with symbol arguments
|
455
487
|
|
456
|
-
*
|
488
|
+
*Abraham Chan*
|
457
489
|
|
458
|
-
|
490
|
+
* Treat `#delete_prefix`, `#delete_suffix` and `#unicode_normalize` results as non-`html_safe`.
|
491
|
+
Ensure safety of arguments for `#insert`, `#[]=` and `#replace` calls on `html_safe` Strings.
|
459
492
|
|
460
|
-
*
|
493
|
+
*Janosch Müller*
|
461
494
|
|
462
|
-
|
463
|
-
|
495
|
+
* Changed `ActiveSupport::TaggedLogging.new` to return a new logger instance instead
|
496
|
+
of mutating the one received as parameter.
|
464
497
|
|
465
|
-
|
466
|
-
secrets introduced in Rails 5.1.
|
498
|
+
*Thierry Joyal*
|
467
499
|
|
468
|
-
|
500
|
+
* Define `unfreeze_time` as an alias of `travel_back` in `ActiveSupport::Testing::TimeHelpers`.
|
469
501
|
|
470
|
-
|
502
|
+
The alias is provided for symmetry with `freeze_time`.
|
471
503
|
|
472
|
-
|
473
|
-
encrypting it with a key.
|
504
|
+
*Ryan Davidson*
|
474
505
|
|
475
|
-
|
506
|
+
* Add support for tracing constant autoloads. Just throw
|
476
507
|
|
477
|
-
|
508
|
+
ActiveSupport::Dependencies.logger = Rails.logger
|
509
|
+
ActiveSupport::Dependencies.verbose = true
|
478
510
|
|
479
|
-
|
480
|
-
similar to `Module#delegate`.
|
511
|
+
in an initializer.
|
481
512
|
|
482
|
-
*
|
513
|
+
*Xavier Noria*
|
483
514
|
|
484
|
-
*
|
515
|
+
* Maintain `html_safe?` on html_safe strings when sliced.
|
485
516
|
|
486
|
-
|
487
|
-
|
517
|
+
string = "<div>test</div>".html_safe
|
518
|
+
string[-1..1].html_safe? # => true
|
488
519
|
|
489
|
-
|
520
|
+
*Elom Gomez*, *Yumin Wong*
|
490
521
|
|
491
|
-
|
492
|
-
# => nil
|
522
|
+
* Add `Array#extract!`.
|
493
523
|
|
494
|
-
|
524
|
+
The method removes and returns the elements for which the block returns a true value.
|
525
|
+
If no block is given, an Enumerator is returned instead.
|
495
526
|
|
496
|
-
|
497
|
-
# =>
|
527
|
+
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
528
|
+
odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9]
|
529
|
+
numbers # => [0, 2, 4, 6, 8]
|
498
530
|
|
499
|
-
*
|
500
|
-
|
501
|
-
* Fix modulo operations involving durations.
|
531
|
+
*bogdanvlviv*
|
502
532
|
|
503
|
-
|
504
|
-
around numeric values as a way of ensuring a duration was the outcome of
|
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.
|
533
|
+
* Support not to cache `nil` for `ActiveSupport::Cache#fetch`.
|
508
534
|
|
509
|
-
|
535
|
+
cache.fetch('bar', skip_nil: true) { nil }
|
536
|
+
cache.exist?('bar') # => false
|
510
537
|
|
511
|
-
|
512
|
-
# => 60
|
538
|
+
*Martin Hong*
|
513
539
|
|
514
|
-
|
540
|
+
* Add "event object" support to the notification system.
|
541
|
+
Before this change, end users were forced to create hand made artisanal
|
542
|
+
event objects on their own, like this:
|
515
543
|
|
516
|
-
|
517
|
-
|
544
|
+
ActiveSupport::Notifications.subscribe('wait') do |*args|
|
545
|
+
@event = ActiveSupport::Notifications::Event.new(*args)
|
546
|
+
end
|
518
547
|
|
519
|
-
|
548
|
+
ActiveSupport::Notifications.instrument('wait') do
|
549
|
+
sleep 1
|
550
|
+
end
|
520
551
|
|
521
|
-
|
552
|
+
@event.duration # => 1000.138
|
522
553
|
|
523
|
-
|
554
|
+
After this change, if the block passed to `subscribe` only takes one
|
555
|
+
parameter, the framework will yield an event object to the block. Now
|
556
|
+
end users are no longer required to make their own:
|
524
557
|
|
525
|
-
|
526
|
-
|
527
|
-
|
558
|
+
ActiveSupport::Notifications.subscribe('wait') do |event|
|
559
|
+
@event = event
|
560
|
+
end
|
528
561
|
|
529
|
-
|
562
|
+
ActiveSupport::Notifications.instrument('wait') do
|
563
|
+
sleep 1
|
564
|
+
end
|
530
565
|
|
531
|
-
|
566
|
+
p @event.allocations # => 7
|
567
|
+
p @event.cpu_time # => 0.256
|
568
|
+
p @event.idle_time # => 1003.2399
|
532
569
|
|
533
|
-
|
534
|
-
`ActiveSupport::MessageEncryptor`.
|
570
|
+
Now you can enjoy event objects without making them yourself. Neat!
|
535
571
|
|
536
|
-
|
572
|
+
*Aaron "t.lo" Patterson*
|
537
573
|
|
538
|
-
|
574
|
+
* Add cpu_time, idle_time, and allocations to Event.
|
539
575
|
|
540
|
-
|
541
|
-
@verifier.verified(token) # => nil
|
576
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
542
577
|
|
543
|
-
|
578
|
+
* RedisCacheStore: support key expiry in increment/decrement.
|
544
579
|
|
545
|
-
|
546
|
-
@verifier.generate("y", expires_at: Time.now.end_of_year)
|
580
|
+
Pass `:expires_in` to `#increment` and `#decrement` to set a Redis EXPIRE on the key.
|
547
581
|
|
548
|
-
|
549
|
-
`ActiveSupport::MessageEncryptor`'s `encrypt_and_sign` and `decrypt_and_verify`.
|
582
|
+
If the key is already set to expire, RedisCacheStore won't extend its expiry.
|
550
583
|
|
551
|
-
|
584
|
+
Rails.cache.increment("some_key", 1, expires_in: 2.minutes)
|
552
585
|
|
553
|
-
*
|
554
|
-
|
555
|
-
* Make the order of `Hash#reverse_merge!` consistent with `HashWithIndifferentAccess`.
|
586
|
+
*Jason Lee*
|
556
587
|
|
557
|
-
|
588
|
+
* Allow `Range#===` and `Range#cover?` on Range.
|
558
589
|
|
559
|
-
|
590
|
+
`Range#cover?` can now accept a range argument like `Range#include?` and
|
591
|
+
`Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
|
592
|
+
into a new file, with these two methods.
|
560
593
|
|
561
|
-
*
|
594
|
+
*Requiring active_support/core_ext/range/include_range is now deprecated.*
|
595
|
+
*Use `require "active_support/core_ext/range/compare_range"` instead.*
|
562
596
|
|
563
|
-
*
|
597
|
+
*utilum*
|
564
598
|
|
565
|
-
|
566
|
-
framework default.
|
599
|
+
* Add `index_with` to Enumerable.
|
567
600
|
|
568
|
-
|
601
|
+
Allows creating a hash from an enumerable with the value from a passed block
|
602
|
+
or a default argument.
|
569
603
|
|
570
|
-
|
604
|
+
%i( title body ).index_with { |attr| post.public_send(attr) }
|
605
|
+
# => { title: "hey", body: "what's up?" }
|
571
606
|
|
572
|
-
|
607
|
+
%i( title body ).index_with(nil)
|
608
|
+
# => { title: nil, body: nil }
|
573
609
|
|
574
|
-
|
575
|
-
Keys that aren't found may be written to the cache store in one shot
|
576
|
-
instead of separate writes.
|
610
|
+
Closely linked with `index_by`, which creates a hash where the keys are extracted from a block.
|
577
611
|
|
578
|
-
|
579
|
-
Stores may override if they're capable of one-shot bulk writes, like
|
580
|
-
Redis `MSET`.
|
612
|
+
*Kasper Timm Hansen*
|
581
613
|
|
582
|
-
|
614
|
+
* Fix bug where `ActiveSupport::TimeZone.all` would fail when tzinfo data for
|
615
|
+
any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
|
583
616
|
|
584
|
-
*
|
617
|
+
*Dominik Sander*
|
585
618
|
|
586
|
-
|
619
|
+
* Redis cache store: `delete_matched` no longer blocks the Redis server.
|
620
|
+
(Switches from evaled Lua to a batched SCAN + DEL loop.)
|
587
621
|
|
588
|
-
|
589
|
-
and `cattr_writer` as well.
|
622
|
+
*Gleb Mazovetskiy*
|
590
623
|
|
591
|
-
|
624
|
+
* Fix bug where `ActiveSupport::Cache` will massively inflate the storage
|
625
|
+
size when compression is enabled (which is true by default). This patch
|
626
|
+
does not attempt to repair existing data: please manually flush the cache
|
627
|
+
to clear out the problematic entries.
|
592
628
|
|
593
|
-
*
|
629
|
+
*Godfrey Chan*
|
594
630
|
|
595
|
-
|
631
|
+
* Fix bug where `URI.unescape` would fail with mixed Unicode/escaped character input:
|
596
632
|
|
597
|
-
|
633
|
+
URI.unescape("\xe3\x83\x90") # => "バ"
|
634
|
+
URI.unescape("%E3%83%90") # => "バ"
|
635
|
+
URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
|
598
636
|
|
599
|
-
|
637
|
+
*Ashe Connor*, *Aaron Patterson*
|
600
638
|
|
601
|
-
|
602
|
-
|
639
|
+
* Add `before?` and `after?` methods to `Date`, `DateTime`,
|
640
|
+
`Time`, and `TimeWithZone`.
|
603
641
|
|
604
|
-
|
642
|
+
*Nick Holden*
|
605
643
|
|
606
|
-
|
644
|
+
* `ActiveSupport::Inflector#ordinal` and `ActiveSupport::Inflector#ordinalize` now support
|
645
|
+
translations through I18n.
|
607
646
|
|
608
|
-
|
647
|
+
# locale/fr.rb
|
609
648
|
|
610
|
-
|
649
|
+
{
|
650
|
+
fr: {
|
651
|
+
number: {
|
652
|
+
nth: {
|
653
|
+
ordinals: lambda do |_key, number:, **_options|
|
654
|
+
if number.to_i.abs == 1
|
655
|
+
'er'
|
656
|
+
else
|
657
|
+
'e'
|
658
|
+
end
|
659
|
+
end,
|
611
660
|
|
612
|
-
|
661
|
+
ordinalized: lambda do |_key, number:, **_options|
|
662
|
+
"#{number}#{ActiveSupport::Inflector.ordinal(number)}"
|
663
|
+
end
|
664
|
+
}
|
665
|
+
}
|
666
|
+
}
|
667
|
+
}
|
613
668
|
|
614
|
-
* Add `ActiveSupport::CurrentAttributes` to provide a thread-isolated attributes singleton.
|
615
|
-
Primary use case is keeping all the per-request attributes easily available to the whole system.
|
616
669
|
|
617
|
-
*
|
670
|
+
*Christian Blais*
|
618
671
|
|
619
|
-
*
|
672
|
+
* Add `:private` option to ActiveSupport's `Module#delegate`
|
673
|
+
in order to delegate methods as private:
|
620
674
|
|
621
|
-
|
622
|
-
|
675
|
+
class User < ActiveRecord::Base
|
676
|
+
has_one :profile
|
677
|
+
delegate :date_of_birth, to: :profile, private: true
|
623
678
|
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
679
|
+
def age
|
680
|
+
Date.today.year - date_of_birth.year
|
681
|
+
end
|
682
|
+
end
|
628
683
|
|
629
|
-
|
630
|
-
|
684
|
+
# User.new.age # => 29
|
685
|
+
# User.new.date_of_birth
|
686
|
+
# => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340>
|
631
687
|
|
632
|
-
|
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
|
688
|
+
*Tomas Valent*
|
636
689
|
|
637
|
-
|
690
|
+
* `String#truncate_bytes` to truncate a string to a maximum bytesize without
|
691
|
+
breaking multibyte characters or grapheme clusters like 👩👩👦👦.
|
638
692
|
|
639
|
-
*
|
693
|
+
*Jeremy Daer*
|
640
694
|
|
641
|
-
*
|
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.
|
695
|
+
* `String#strip_heredoc` preserves frozenness.
|
644
696
|
|
645
|
-
|
697
|
+
"foo".freeze.strip_heredoc.frozen? # => true
|
646
698
|
|
647
|
-
|
699
|
+
Fixes that frozen string literals would inadvertently become unfrozen:
|
648
700
|
|
649
|
-
|
701
|
+
# frozen_string_literal: true
|
650
702
|
|
651
|
-
|
703
|
+
foo = <<-MSG.strip_heredoc
|
704
|
+
la la la
|
705
|
+
MSG
|
652
706
|
|
653
|
-
|
707
|
+
foo.frozen? # => false !??
|
654
708
|
|
655
|
-
*
|
709
|
+
*Jeremy Daer*
|
656
710
|
|
657
|
-
|
711
|
+
* Rails 6 requires Ruby 2.5.0 or newer.
|
658
712
|
|
659
|
-
*
|
713
|
+
*Jeremy Daer*, *Kasper Timm Hansen*
|
660
714
|
|
661
|
-
*
|
715
|
+
* Adds parallel testing to Rails.
|
662
716
|
|
663
|
-
|
717
|
+
Parallelize your test suite with forked processes or threads.
|
664
718
|
|
665
|
-
*
|
719
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
666
720
|
|
667
721
|
|
668
|
-
Please check [5-
|
722
|
+
Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/activesupport/CHANGELOG.md) for previous changes.
|