activesupport 5.0.7.2 → 5.1.7
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 +464 -694
- data/MIT-LICENSE +1 -1
- data/README.rdoc +1 -1
- data/lib/active_support.rb +8 -4
- data/lib/active_support/all.rb +3 -3
- data/lib/active_support/array_inquirer.rb +7 -5
- data/lib/active_support/backtrace_cleaner.rb +4 -4
- data/lib/active_support/benchmarkable.rb +3 -3
- data/lib/active_support/builder.rb +1 -1
- data/lib/active_support/cache.rb +41 -48
- data/lib/active_support/cache/file_store.rb +11 -20
- data/lib/active_support/cache/mem_cache_store.rb +30 -40
- data/lib/active_support/cache/memory_store.rb +13 -13
- data/lib/active_support/cache/null_store.rb +4 -4
- data/lib/active_support/cache/strategy/local_cache.rb +13 -22
- data/lib/active_support/cache/strategy/local_cache_middleware.rb +4 -5
- data/lib/active_support/callbacks.rb +649 -584
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +17 -0
- data/lib/active_support/concurrency/share_lock.rb +20 -21
- data/lib/active_support/configurable.rb +5 -5
- data/lib/active_support/core_ext.rb +1 -2
- data/lib/active_support/core_ext/array.rb +7 -7
- data/lib/active_support/core_ext/array/access.rb +1 -1
- data/lib/active_support/core_ext/array/conversions.rb +15 -15
- data/lib/active_support/core_ext/array/grouping.rb +1 -1
- data/lib/active_support/core_ext/array/inquiry.rb +1 -1
- data/lib/active_support/core_ext/array/prepend_and_append.rb +1 -1
- data/lib/active_support/core_ext/benchmark.rb +1 -1
- data/lib/active_support/core_ext/big_decimal.rb +1 -1
- data/lib/active_support/core_ext/big_decimal/conversions.rb +4 -6
- data/lib/active_support/core_ext/class.rb +2 -2
- data/lib/active_support/core_ext/class/attribute.rb +5 -5
- data/lib/active_support/core_ext/class/attribute_accessors.rb +1 -1
- data/lib/active_support/core_ext/class/subclasses.rb +18 -4
- data/lib/active_support/core_ext/date.rb +5 -5
- data/lib/active_support/core_ext/date/acts_like.rb +1 -1
- data/lib/active_support/core_ext/date/blank.rb +1 -1
- data/lib/active_support/core_ext/date/calculations.rb +8 -8
- data/lib/active_support/core_ext/date/conversions.rb +12 -12
- data/lib/active_support/core_ext/date/zones.rb +2 -2
- data/lib/active_support/core_ext/date_and_time/calculations.rb +27 -22
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +1 -1
- data/lib/active_support/core_ext/date_and_time/zones.rb +7 -8
- data/lib/active_support/core_ext/date_time.rb +5 -5
- data/lib/active_support/core_ext/date_time/acts_like.rb +2 -2
- data/lib/active_support/core_ext/date_time/blank.rb +1 -1
- data/lib/active_support/core_ext/date_time/calculations.rb +20 -10
- data/lib/active_support/core_ext/date_time/compatibility.rb +2 -2
- data/lib/active_support/core_ext/date_time/conversions.rb +12 -12
- data/lib/active_support/core_ext/digest/uuid.rb +4 -4
- data/lib/active_support/core_ext/enumerable.rb +23 -12
- data/lib/active_support/core_ext/file.rb +1 -1
- data/lib/active_support/core_ext/file/atomic.rb +4 -4
- data/lib/active_support/core_ext/hash.rb +9 -9
- data/lib/active_support/core_ext/hash/compact.rb +12 -9
- data/lib/active_support/core_ext/hash/conversions.rb +36 -37
- data/lib/active_support/core_ext/hash/indifferent_access.rb +1 -2
- data/lib/active_support/core_ext/hash/keys.rb +6 -6
- data/lib/active_support/core_ext/hash/reverse_merge.rb +1 -1
- data/lib/active_support/core_ext/hash/slice.rb +4 -4
- data/lib/active_support/core_ext/hash/transform_values.rb +1 -0
- data/lib/active_support/core_ext/integer.rb +3 -3
- data/lib/active_support/core_ext/integer/inflections.rb +1 -1
- data/lib/active_support/core_ext/integer/time.rb +2 -2
- data/lib/active_support/core_ext/kernel.rb +4 -4
- data/lib/active_support/core_ext/kernel/concern.rb +1 -1
- data/lib/active_support/core_ext/kernel/reporting.rb +1 -1
- data/lib/active_support/core_ext/load_error.rb +1 -18
- data/lib/active_support/core_ext/module.rb +11 -12
- data/lib/active_support/core_ext/module/aliasing.rb +3 -48
- data/lib/active_support/core_ext/module/attr_internal.rb +4 -4
- data/lib/active_support/core_ext/module/attribute_accessors.rb +11 -5
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +20 -13
- data/lib/active_support/core_ext/module/concerning.rb +1 -1
- data/lib/active_support/core_ext/module/delegation.rb +85 -16
- data/lib/active_support/core_ext/module/introspection.rb +3 -11
- data/lib/active_support/core_ext/module/reachable.rb +2 -2
- data/lib/active_support/core_ext/numeric.rb +4 -4
- data/lib/active_support/core_ext/numeric/conversions.rb +3 -9
- data/lib/active_support/core_ext/numeric/inquiry.rb +21 -21
- data/lib/active_support/core_ext/numeric/time.rb +5 -5
- data/lib/active_support/core_ext/object.rb +12 -12
- data/lib/active_support/core_ext/object/blank.rb +3 -1
- data/lib/active_support/core_ext/object/conversions.rb +4 -4
- data/lib/active_support/core_ext/object/deep_dup.rb +1 -1
- data/lib/active_support/core_ext/object/duplicable.rb +34 -4
- data/lib/active_support/core_ext/object/inclusion.rb +1 -1
- data/lib/active_support/core_ext/object/json.rb +26 -12
- data/lib/active_support/core_ext/object/to_param.rb +1 -1
- data/lib/active_support/core_ext/object/to_query.rb +8 -5
- data/lib/active_support/core_ext/object/try.rb +1 -1
- data/lib/active_support/core_ext/object/with_options.rb +12 -1
- data/lib/active_support/core_ext/range.rb +4 -4
- data/lib/active_support/core_ext/range/conversions.rb +1 -1
- data/lib/active_support/core_ext/regexp.rb +4 -0
- data/lib/active_support/core_ext/securerandom.rb +3 -3
- data/lib/active_support/core_ext/string.rb +13 -13
- data/lib/active_support/core_ext/string/access.rb +6 -6
- data/lib/active_support/core_ext/string/conversions.rb +2 -2
- data/lib/active_support/core_ext/string/filters.rb +3 -3
- data/lib/active_support/core_ext/string/indent.rb +4 -4
- data/lib/active_support/core_ext/string/inflections.rb +10 -14
- data/lib/active_support/core_ext/string/inquiry.rb +1 -1
- data/lib/active_support/core_ext/string/multibyte.rb +1 -1
- data/lib/active_support/core_ext/string/output_safety.rb +19 -20
- data/lib/active_support/core_ext/string/strip.rb +1 -1
- data/lib/active_support/core_ext/string/zones.rb +2 -2
- data/lib/active_support/core_ext/time.rb +5 -5
- data/lib/active_support/core_ext/time/acts_like.rb +1 -1
- data/lib/active_support/core_ext/time/calculations.rb +46 -29
- data/lib/active_support/core_ext/time/conversions.rb +15 -12
- data/lib/active_support/core_ext/time/zones.rb +3 -3
- data/lib/active_support/core_ext/uri.rb +2 -2
- data/lib/active_support/dependencies.rb +45 -46
- data/lib/active_support/dependencies/interlock.rb +1 -1
- data/lib/active_support/deprecation.rb +9 -8
- data/lib/active_support/deprecation/behaviors.rb +3 -3
- data/lib/active_support/deprecation/constant_accessor.rb +50 -0
- data/lib/active_support/deprecation/instance_delegator.rb +2 -2
- data/lib/active_support/deprecation/method_wrappers.rb +10 -3
- data/lib/active_support/deprecation/proxy_wrappers.rb +6 -4
- data/lib/active_support/deprecation/reporting.rb +7 -7
- data/lib/active_support/duration.rb +221 -28
- data/lib/active_support/duration/iso8601_parser.rb +66 -65
- data/lib/active_support/duration/iso8601_serializer.rb +11 -9
- data/lib/active_support/evented_file_update_checker.rb +59 -55
- data/lib/active_support/execution_wrapper.rb +3 -3
- data/lib/active_support/executor.rb +1 -1
- data/lib/active_support/file_update_checker.rb +54 -50
- data/lib/active_support/gem_version.rb +2 -2
- data/lib/active_support/gzip.rb +4 -4
- data/lib/active_support/hash_with_indifferent_access.rb +40 -28
- data/lib/active_support/i18n.rb +5 -5
- data/lib/active_support/i18n_railtie.rb +14 -9
- data/lib/active_support/inflections.rb +11 -11
- data/lib/active_support/inflector.rb +5 -5
- data/lib/active_support/inflector/inflections.rb +11 -9
- data/lib/active_support/inflector/methods.rb +52 -51
- data/lib/active_support/inflector/transliterate.rb +8 -11
- data/lib/active_support/json.rb +2 -2
- data/lib/active_support/json/decoding.rb +3 -3
- data/lib/active_support/json/encoding.rb +8 -7
- data/lib/active_support/key_generator.rb +17 -17
- data/lib/active_support/lazy_load_hooks.rb +2 -2
- data/lib/active_support/log_subscriber.rb +9 -7
- data/lib/active_support/log_subscriber/test_helper.rb +9 -9
- data/lib/active_support/logger.rb +3 -3
- data/lib/active_support/logger_silence.rb +3 -3
- data/lib/active_support/logger_thread_safe_level.rb +1 -1
- data/lib/active_support/message_encryptor.rb +77 -35
- data/lib/active_support/message_verifier.rb +7 -7
- data/lib/active_support/multibyte.rb +2 -2
- data/lib/active_support/multibyte/chars.rb +23 -21
- data/lib/active_support/multibyte/unicode.rb +68 -89
- data/lib/active_support/notifications.rb +7 -5
- data/lib/active_support/notifications/fanout.rb +3 -3
- data/lib/active_support/notifications/instrumenter.rb +5 -5
- data/lib/active_support/number_helper.rb +5 -4
- data/lib/active_support/number_helper/number_converter.rb +11 -11
- data/lib/active_support/number_helper/number_to_currency_converter.rb +3 -3
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +1 -2
- data/lib/active_support/number_helper/number_to_human_converter.rb +8 -10
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +6 -11
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +1 -1
- data/lib/active_support/number_helper/number_to_phone_converter.rb +1 -3
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +12 -32
- data/lib/active_support/number_helper/rounding_helper.rb +64 -0
- data/lib/active_support/option_merger.rb +1 -1
- data/lib/active_support/ordered_hash.rb +3 -3
- data/lib/active_support/ordered_options.rb +6 -4
- data/lib/active_support/per_thread_registry.rb +5 -5
- data/lib/active_support/rails.rb +12 -6
- data/lib/active_support/railtie.rb +3 -3
- data/lib/active_support/reloader.rb +1 -1
- data/lib/active_support/rescuable.rb +6 -6
- data/lib/active_support/security_utils.rb +1 -1
- data/lib/active_support/string_inquirer.rb +8 -2
- data/lib/active_support/subscriber.rb +9 -5
- data/lib/active_support/tagged_logging.rb +4 -4
- data/lib/active_support/test_case.rb +12 -29
- data/lib/active_support/testing/assertions.rb +100 -2
- data/lib/active_support/testing/autorun.rb +2 -2
- data/lib/active_support/testing/constant_lookup.rb +0 -1
- data/lib/active_support/testing/declarative.rb +1 -1
- data/lib/active_support/testing/deprecation.rb +3 -2
- data/lib/active_support/testing/isolation.rb +15 -22
- data/lib/active_support/testing/method_call_assertions.rb +1 -1
- data/lib/active_support/testing/setup_and_teardown.rb +2 -2
- data/lib/active_support/testing/stream.rb +28 -28
- data/lib/active_support/testing/tagged_logging.rb +1 -1
- data/lib/active_support/testing/time_helpers.rb +45 -11
- data/lib/active_support/time.rb +12 -12
- data/lib/active_support/time_with_zone.rb +16 -14
- data/lib/active_support/values/time_zone.rb +100 -31
- data/lib/active_support/values/unicode_tables.dat +0 -0
- data/lib/active_support/version.rb +1 -1
- data/lib/active_support/xml_mini.rb +34 -36
- data/lib/active_support/xml_mini/jdom.rb +112 -112
- data/lib/active_support/xml_mini/libxml.rb +12 -11
- data/lib/active_support/xml_mini/libxmlsax.rb +13 -14
- data/lib/active_support/xml_mini/nokogiri.rb +10 -10
- data/lib/active_support/xml_mini/nokogirisax.rb +12 -13
- data/lib/active_support/xml_mini/rexml.rb +9 -9
- metadata +8 -9
- data/lib/active_support/concurrency/latch.rb +0 -26
- data/lib/active_support/core_ext/kernel/debugger.rb +0 -3
- data/lib/active_support/core_ext/module/method_transplanting.rb +0 -3
- data/lib/active_support/core_ext/module/qualified_const.rb +0 -70
- data/lib/active_support/core_ext/struct.rb +0 -3
- data/lib/active_support/core_ext/time/marshal.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ece0ba787f6df68f2378c0e387d18f2a56a00359a4885e0d155ba9e57811caa
|
4
|
+
data.tar.gz: 4fc1a1e4b58d382f0fd49539f28707234d7828c46a79c9bca397c1d327ca25b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78703452ca309f7344f0e8d544bbe093147dba9cbd09917ed4aa72f2e1121ff3cf1835cd062a169d680dd2d7457d892a771d2947f7ce9b1729199a48dd745947
|
7
|
+
data.tar.gz: ac4bdb64bfd7815044ec53ccd8008f6c62733c525437069d466a33f1af0d0566ded8017daa872269d4921bf777f67662edb0043d68dee271e0defe25b3c42ec7
|
data/CHANGELOG.md
CHANGED
@@ -1,14 +1,19 @@
|
|
1
|
-
## Rails 5.
|
1
|
+
## Rails 5.1.7 (March 27, 2019) ##
|
2
2
|
|
3
3
|
* No changes.
|
4
4
|
|
5
5
|
|
6
|
-
## Rails 5.
|
6
|
+
## Rails 5.1.6.2 (March 11, 2019) ##
|
7
7
|
|
8
8
|
* No changes.
|
9
9
|
|
10
10
|
|
11
|
-
## Rails 5.
|
11
|
+
## Rails 5.1.6.1 (November 27, 2018) ##
|
12
|
+
|
13
|
+
* No changes.
|
14
|
+
|
15
|
+
|
16
|
+
## Rails 5.1.6 (March 29, 2018) ##
|
12
17
|
|
13
18
|
* Return all mappings for a timezone identifier in `country_zones`
|
14
19
|
|
@@ -27,992 +32,757 @@
|
|
27
32
|
*Andrew White*
|
28
33
|
|
29
34
|
|
30
|
-
## Rails 5.
|
35
|
+
## Rails 5.1.5 (February 14, 2018) ##
|
31
36
|
|
32
37
|
* No changes.
|
33
38
|
|
34
39
|
|
35
|
-
## Rails 5.
|
40
|
+
## Rails 5.1.4 (September 07, 2017) ##
|
36
41
|
|
37
42
|
* No changes.
|
38
43
|
|
39
44
|
|
40
|
-
## Rails 5.
|
45
|
+
## Rails 5.1.4.rc1 (August 24, 2017) ##
|
41
46
|
|
42
47
|
* No changes.
|
43
48
|
|
44
49
|
|
45
|
-
## Rails 5.
|
50
|
+
## Rails 5.1.3 (August 03, 2017) ##
|
46
51
|
|
47
52
|
* No changes.
|
48
53
|
|
49
54
|
|
50
|
-
## Rails 5.
|
55
|
+
## Rails 5.1.3.rc3 (July 31, 2017) ##
|
51
56
|
|
52
|
-
*
|
57
|
+
* Fix modulo operations involving durations
|
53
58
|
|
59
|
+
Rails 5.1 introduce an `ActiveSupport::Duration::Scalar` class as a wrapper
|
60
|
+
around a numeric value as a way of ensuring a duration was the outcome of
|
61
|
+
an expression. However the implementation was missing support for modulo
|
62
|
+
operations. This support has now been added and should result in a duration
|
63
|
+
being returned from expressions involving modulo operations.
|
54
64
|
|
55
|
-
|
65
|
+
Prior to Rails 5.1:
|
56
66
|
|
57
|
-
|
67
|
+
5.minutes % 2.minutes
|
68
|
+
=> 60
|
58
69
|
|
70
|
+
Now:
|
59
71
|
|
60
|
-
|
72
|
+
5.minutes % 2.minutes
|
73
|
+
=> 1 minute
|
61
74
|
|
62
|
-
|
63
|
-
directories outside of the application directory.
|
75
|
+
Fixes #29603 and #29743.
|
64
76
|
|
65
|
-
*
|
77
|
+
*Sayan Chakraborty*, *Andrew White*
|
66
78
|
|
67
|
-
*
|
79
|
+
* Fix division where a duration is the denominator
|
68
80
|
|
69
|
-
|
70
|
-
|
81
|
+
PR #29163 introduced a change in behavior when a duration was the denominator
|
82
|
+
in a calculation - this was incorrect as dividing by a duration should always
|
83
|
+
return a `Numeric`. The behavior of previous versions of Rails has been restored.
|
71
84
|
|
72
|
-
Fixes #
|
85
|
+
Fixes #29592.
|
73
86
|
|
74
87
|
*Andrew White*
|
75
88
|
|
76
|
-
* Fixed bug in `DateAndTime::Compatibility#to_time` that caused it to
|
77
|
-
raise `RuntimeError: can't modify frozen Time` when called on any frozen `Time`.
|
78
|
-
Properly pass through the frozen `Time` or `ActiveSupport::TimeWithZone` object
|
79
|
-
when calling `#to_time`.
|
80
|
-
|
81
|
-
*Kevin McPhillips* & *Andrew White*
|
82
|
-
|
83
|
-
* Fix inconsistent results when parsing large durations and constructing durations from code
|
84
89
|
|
85
|
-
|
86
|
-
|
87
|
-
Duration parsing made independent from any moment of time:
|
88
|
-
Fixed length in seconds is assigned to each duration part during parsing.
|
89
|
-
|
90
|
-
Methods on `Numeric` like `2.days` now use these predefined durations
|
91
|
-
to avoid duplicating of duration constants through the codebase and
|
92
|
-
eliminate creation of intermediate durations.
|
93
|
-
|
94
|
-
*Andrey Novikov, Andrew White*
|
95
|
-
|
96
|
-
|
97
|
-
## Rails 5.0.2 (March 01, 2017) ##
|
98
|
-
|
99
|
-
* In Core Extensions, make `MarshalWithAutoloading#load` pass through the second, optional
|
100
|
-
argument for `Marshal#load( source [, proc] )`. This way we don't have to do
|
101
|
-
`Marshal.method(:load).super_method.call(sourse, proc)` just to be able to pass a proc.
|
102
|
-
|
103
|
-
*Jeff Latz*
|
104
|
-
|
105
|
-
* `ActiveSupport::Gzip.decompress` now checks checksum and length in footer.
|
106
|
-
|
107
|
-
*Dylan Thacker-Smith*
|
108
|
-
|
109
|
-
* Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing.
|
110
|
-
|
111
|
-
*Adam Rice*
|
112
|
-
|
113
|
-
|
114
|
-
## Rails 5.0.1 (December 21, 2016) ##
|
90
|
+
## Rails 5.1.3.rc2 (July 25, 2017) ##
|
115
91
|
|
116
92
|
* No changes.
|
117
93
|
|
118
94
|
|
119
|
-
## Rails 5.
|
95
|
+
## Rails 5.1.3.rc1 (July 19, 2017) ##
|
120
96
|
|
121
97
|
* No changes.
|
122
98
|
|
123
99
|
|
124
|
-
## Rails 5.
|
100
|
+
## Rails 5.1.2 (June 26, 2017) ##
|
125
101
|
|
126
|
-
*
|
102
|
+
* Cache: Restore the `options = nil` argument for `LocalStore#clear`
|
103
|
+
that was removed in 5.1.0. Restores compatibility with backends that
|
104
|
+
take an options argument and use the local cache strategy.
|
127
105
|
|
128
|
-
|
129
|
-
`Time#advance` to calculate the number of seconds in the duration
|
130
|
-
from an arbitrary collection of parts. However as `advance` tries to
|
131
|
-
be consistent across DST boundaries this meant that either the
|
132
|
-
duration was shorter or longer depending on the time of year.
|
106
|
+
*Jeremy Daer*
|
133
107
|
|
134
|
-
|
135
|
-
isn't subject to DST transitions. An arbitrary date of Jan 1st, 2000
|
136
|
-
was chosen for no other reason that it seemed appropriate.
|
108
|
+
* Fix implicit coercion calculations with scalars and durations
|
137
109
|
|
138
|
-
|
139
|
-
|
140
|
-
every time we parse a duration string.
|
110
|
+
Previously calculations where the scalar is first would be converted to a duration
|
111
|
+
of seconds but this causes issues with dates being converted to times, e.g:
|
141
112
|
|
142
|
-
|
113
|
+
Time.zone = "Beijing" # => Asia/Shanghai
|
114
|
+
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
|
115
|
+
2 * 1.day # => 172800 seconds
|
116
|
+
date + 2 * 1.day # => Mon, 22 May 2017 00:00:00 CST +08:00
|
143
117
|
|
144
|
-
|
118
|
+
Now the `ActiveSupport::Duration::Scalar` calculation methods will try to maintain
|
119
|
+
the part structure of the duration where possible, e.g:
|
145
120
|
|
146
|
-
|
121
|
+
Time.zone = "Beijing" # => Asia/Shanghai
|
122
|
+
date = Date.civil(2017, 5, 20) # => Mon, 20 May 2017
|
123
|
+
2 * 1.day # => 2 days
|
124
|
+
date + 2 * 1.day # => Mon, 22 May 2017
|
147
125
|
|
148
|
-
|
126
|
+
Fixes #29160, #28970.
|
149
127
|
|
150
|
-
*
|
128
|
+
*Andrew White*
|
151
129
|
|
152
|
-
* Avoid bumping the class serial when invoking executor.
|
153
130
|
|
154
|
-
|
131
|
+
## Rails 5.1.1 (May 12, 2017) ##
|
155
132
|
|
156
|
-
*
|
133
|
+
* No changes.
|
157
134
|
|
158
|
-
Previously calls to `in` were being sent to the non-DST aware
|
159
|
-
method `Time#since` via `method_missing`. It is now aliased to
|
160
|
-
the DST aware `ActiveSupport::TimeWithZone#+` which handles
|
161
|
-
transitions across DST boundaries, e.g:
|
162
135
|
|
163
|
-
|
136
|
+
## Rails 5.1.0 (April 27, 2017) ##
|
164
137
|
|
165
|
-
|
166
|
-
|
138
|
+
* `ActiveSupport::EventedFileUpdateChecker` no longer listens to
|
139
|
+
directories outside of the application directory.
|
167
140
|
|
168
|
-
|
169
|
-
# => Sun, 06 Nov 2016 01:00:00 EST -05:00
|
141
|
+
*radiospiel*
|
170
142
|
|
171
|
-
|
143
|
+
* Return unmapped timezones from `country_zones`
|
172
144
|
|
173
|
-
|
145
|
+
If a country doesn't exist in the MAPPINGS hash then create a new
|
146
|
+
`ActiveSupport::Timezone` instance using the supplied timezone id.
|
174
147
|
|
175
|
-
|
148
|
+
Fixes #28431.
|
176
149
|
|
177
|
-
|
178
|
-
longer changes the value of the parent class. This brings the
|
179
|
-
behavior inline with the documentation.
|
150
|
+
*Andrew White*
|
180
151
|
|
181
|
-
|
152
|
+
* Add ActiveSupport::Deprecation::DeprecatedConstantAccessor
|
182
153
|
|
183
|
-
|
184
|
-
|
185
|
-
end
|
154
|
+
Provides transparent deprecation of constants, compatible with exceptions.
|
155
|
+
Example usage:
|
186
156
|
|
187
|
-
|
157
|
+
module Example
|
158
|
+
include ActiveSupport::Deprecation::DeprecatedConstantAccessor
|
159
|
+
deprecate_constant 'OldException', 'Elsewhere::NewException'
|
188
160
|
end
|
189
161
|
|
190
|
-
|
191
|
-
Customer.user = "Rafael"
|
192
|
-
|
193
|
-
Before:
|
162
|
+
*Dominic Cleal*
|
194
163
|
|
195
|
-
|
164
|
+
* Fixed bug in `DateAndTime::Compatibility#to_time` that caused it to
|
165
|
+
raise `RuntimeError: can't modify frozen Time` when called on any frozen `Time`.
|
166
|
+
Properly pass through the frozen `Time` or `ActiveSupport::TimeWithZone` object
|
167
|
+
when calling `#to_time`.
|
196
168
|
|
197
|
-
|
169
|
+
*Kevin McPhillips* & *Andrew White*
|
198
170
|
|
199
|
-
|
171
|
+
* Remove implicit coercion deprecation of durations
|
200
172
|
|
201
|
-
|
173
|
+
In #28204 we deprecated implicit conversion of durations to a numeric which
|
174
|
+
represented the number of seconds in the duration because of unwanted side
|
175
|
+
effects with calculations on durations and dates. This unfortunately had
|
176
|
+
the side effect of forcing a explicit cast when configuring third-party
|
177
|
+
libraries like expiration in Redis, e.g:
|
202
178
|
|
203
|
-
|
204
|
-
parts that `ActiveSupport::TimeWithZone` will recognize as possibly being
|
205
|
-
of variable duration to take account of DST transitions.
|
179
|
+
redis.expire("foo", 5.minutes)
|
206
180
|
|
207
|
-
|
181
|
+
To work around this we've removed the deprecation and added a private class
|
182
|
+
that wraps the numeric and can perform calculation involving durations and
|
183
|
+
ensure that they remain a duration irrespective of the order of operations.
|
208
184
|
|
209
185
|
*Andrew White*
|
210
186
|
|
211
|
-
*
|
212
|
-
given time doesn't match the format. The error is the same as the one given
|
213
|
-
by Ruby's `Date.strptime`. Previously it raised
|
214
|
-
`NoMethodError: undefined method empty? for nil:NilClass.` due to a bug.
|
215
|
-
|
216
|
-
Fixes #25701.
|
217
|
-
|
218
|
-
*John Gesimondo*
|
219
|
-
|
220
|
-
|
221
|
-
## Rails 5.0.0 (June 30, 2016) ##
|
222
|
-
|
223
|
-
* Support parsing JSON time in ISO8601 local time strings in
|
224
|
-
`ActiveSupport::JSON.decode` when `parse_json_times` is enabled.
|
225
|
-
Strings in the format of `YYYY-MM-DD hh:mm:ss` (without a `Z` at
|
226
|
-
the end) will be parsed in the local timezone (`Time.zone`). In
|
227
|
-
addition, date strings (`YYYY-MM-DD`) are now parsed into `Date`
|
228
|
-
objects.
|
229
|
-
|
230
|
-
*Grzegorz Witek*
|
231
|
-
|
232
|
-
* `Date.to_s` doesn't produce too many spaces. For example, `to_s(:short)`
|
233
|
-
will now produce `01 Feb` instead of ` 1 Feb`.
|
234
|
-
|
235
|
-
Fixes #25251.
|
236
|
-
|
237
|
-
*Sean Griffin*
|
238
|
-
|
239
|
-
* Rescuable: If a handler doesn't match the exception, check for handlers
|
240
|
-
matching the exception's cause.
|
241
|
-
|
242
|
-
*Jeremy Daer*
|
243
|
-
|
244
|
-
* `ActiveSupport::Duration` supports weeks and hours.
|
245
|
-
|
246
|
-
[1.hour.inspect, 1.hour.value, 1.hour.parts]
|
247
|
-
# => ["3600 seconds", 3600, [[:seconds, 3600]]] # Before
|
248
|
-
# => ["1 hour", 3600, [[:hours, 1]]] # After
|
249
|
-
|
250
|
-
[1.week.inspect, 1.week.value, 1.week.parts]
|
251
|
-
# => ["7 days", 604800, [[:days, 7]]] # Before
|
252
|
-
# => ["1 week", 604800, [[:weeks, 1]]] # After
|
253
|
-
|
254
|
-
This brings us into closer conformance with ISO8601 and relieves some
|
255
|
-
astonishment about getting `1.hour.inspect # => 3600 seconds`.
|
256
|
-
|
257
|
-
Compatibility: The duration's `value` remains the same, so apps using
|
258
|
-
durations are oblivious to the new time periods. Apps, libraries, and
|
259
|
-
plugins that work with the internal `parts` hash will need to broaden
|
260
|
-
their time period handling to cover hours & weeks.
|
187
|
+
* Update `titleize` regex to allow apostrophes
|
261
188
|
|
262
|
-
|
189
|
+
In 4b685aa the regex in `titleize` was updated to not match apostrophes to
|
190
|
+
better reflect the nature of the transformation. Unfortunately, this had the
|
191
|
+
side effect of breaking capitalization on the first word of a sub-string, e.g:
|
263
192
|
|
264
|
-
|
265
|
-
|
266
|
-
but this is still relatively quick and isn't in any hot paths.
|
193
|
+
>> "This was 'fake news'".titleize
|
194
|
+
=> "This Was 'fake News'"
|
267
195
|
|
268
|
-
|
269
|
-
|
270
|
-
* Make `getlocal` and `getutc` always return instances of `Time` for
|
271
|
-
`ActiveSupport::TimeWithZone` and `DateTime`. This eliminates a possible
|
272
|
-
stack level too deep error in `to_time` where `ActiveSupport::TimeWithZone`
|
273
|
-
was wrapping a `DateTime` instance. As a consequence of this the internal
|
274
|
-
time value in `ActiveSupport::TimeWithZone` is now always an instance of
|
275
|
-
`Time` in the UTC timezone, whether that's as the UTC time directly or
|
276
|
-
a representation of the local time in the timezone. There should be no
|
277
|
-
consequences of this internal change and if there are it's a bug due to
|
278
|
-
leaky abstractions.
|
279
|
-
|
280
|
-
*Andrew White*
|
281
|
-
|
282
|
-
* Add `DateTime#subsec` to return the fraction of a second as a `Rational`.
|
283
|
-
|
284
|
-
*Andrew White*
|
196
|
+
This is fixed by extending the look-behind to also check for a word
|
197
|
+
character on the other side of the apostrophe.
|
285
198
|
|
286
|
-
|
287
|
-
`ActiveSupport::TimeWithZone` and `Time`.
|
199
|
+
Fixes #28312.
|
288
200
|
|
289
201
|
*Andrew White*
|
290
202
|
|
291
|
-
* Add `
|
292
|
-
local timezone. Also aliased to `getlocal`.
|
203
|
+
* Add `rfc3339` aliases to `xmlschema` for `Time` and `ActiveSupport::TimeWithZone`
|
293
204
|
|
294
|
-
|
295
|
-
|
296
|
-
* Add `Time#sec_fraction` to return the fraction of a second as a `Rational`.
|
205
|
+
For naming consistency when using the RFC 3339 profile of ISO 8601 in applications.
|
297
206
|
|
298
207
|
*Andrew White*
|
299
208
|
|
300
|
-
* Add `
|
301
|
-
how `to_time` handles timezones. In Ruby 2.4+ the behavior will change
|
302
|
-
from converting to the local system timezone, to preserving the timezone
|
303
|
-
of the receiver. This config option defaults to false so that apps made
|
304
|
-
with earlier versions of Rails are not affected when upgrading, e.g:
|
305
|
-
|
306
|
-
>> ENV['TZ'] = 'US/Eastern'
|
307
|
-
|
308
|
-
>> "2016-04-23T10:23:12.000Z".to_time
|
309
|
-
=> "2016-04-23T06:23:12.000-04:00"
|
209
|
+
* Add `Time.rfc3339` parsing method
|
310
210
|
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
=> "2016-04-23T10:23:12.000Z"
|
315
|
-
|
316
|
-
Fixes #24617.
|
211
|
+
`Time.xmlschema` and consequently its alias `iso8601` accepts timestamps
|
212
|
+
without a offset in contravention of the RFC 3339 standard. This method
|
213
|
+
enforces that constraint and raises an `ArgumentError` if it doesn't.
|
317
214
|
|
318
215
|
*Andrew White*
|
319
216
|
|
320
|
-
* `ActiveSupport::TimeZone.
|
321
|
-
country's time zones by its two-letter ISO3166 country code, e.g.
|
322
|
-
|
323
|
-
>> ActiveSupport::TimeZone.country_zones(:jp).map(&:to_s)
|
324
|
-
=> ["(GMT+09:00) Osaka"]
|
217
|
+
* Add `ActiveSupport::TimeZone.rfc3339` parsing method
|
325
218
|
|
326
|
-
|
327
|
-
|
219
|
+
Previously, there was no way to get a RFC 3339 timestamp into a specific
|
220
|
+
timezone without either using `parse` or chaining methods. The new method
|
221
|
+
allows parsing directly into the timezone, e.g:
|
328
222
|
|
329
|
-
|
223
|
+
>> Time.zone = "Hawaii"
|
224
|
+
=> "Hawaii"
|
225
|
+
>> Time.zone.rfc3339("1999-12-31T14:00:00Z")
|
226
|
+
=> Fri, 31 Dec 1999 14:00:00 HST -10:00
|
330
227
|
|
331
|
-
|
228
|
+
This new method has stricter semantics than the current `parse` method,
|
229
|
+
and will raise an `ArgumentError` instead of returning nil, e.g:
|
332
230
|
|
333
|
-
|
334
|
-
|
335
|
-
|
231
|
+
>> Time.zone = "Hawaii"
|
232
|
+
=> "Hawaii"
|
233
|
+
>> Time.zone.rfc3339("foobar")
|
234
|
+
ArgumentError: invalid date
|
235
|
+
>> Time.zone.parse("foobar")
|
236
|
+
=> nil
|
336
237
|
|
337
|
-
|
238
|
+
It will also raise an `ArgumentError` when either the time or offset
|
239
|
+
components are missing, e.g:
|
338
240
|
|
339
|
-
|
340
|
-
|
241
|
+
>> Time.zone = "Hawaii"
|
242
|
+
=> "Hawaii"
|
243
|
+
>> Time.zone.rfc3339("1999-12-31")
|
244
|
+
ArgumentError: invalid date
|
245
|
+
>> Time.zone.rfc3339("1999-12-31T14:00:00")
|
246
|
+
ArgumentError: invalid date
|
341
247
|
|
342
|
-
|
343
|
-
|
344
|
-
%w[ a b ].sum
|
345
|
-
# => 'ab'
|
248
|
+
*Andrew White*
|
346
249
|
|
347
|
-
|
348
|
-
if it fails, but that ends up slower even in simple cases due to the cost
|
349
|
-
of exception handling. Our only choice is to override the native `Array#sum`
|
350
|
-
with our `Enumerable#sum`.
|
250
|
+
* Add `ActiveSupport::TimeZone.iso8601` parsing method
|
351
251
|
|
352
|
-
|
252
|
+
Previously, there was no way to get a ISO 8601 timestamp into a specific
|
253
|
+
timezone without either using `parse` or chaining methods. The new method
|
254
|
+
allows parsing directly into the timezone, e.g:
|
353
255
|
|
354
|
-
|
256
|
+
>> Time.zone = "Hawaii"
|
257
|
+
=> "Hawaii"
|
258
|
+
>> Time.zone.iso8601("1999-12-31T14:00:00Z")
|
259
|
+
=> Fri, 31 Dec 1999 14:00:00 HST -10:00
|
355
260
|
|
356
|
-
|
357
|
-
|
261
|
+
If the timestamp is a ISO 8601 date (YYYY-MM-DD), then the time is set
|
262
|
+
to midnight, e.g:
|
358
263
|
|
359
|
-
|
360
|
-
|
264
|
+
>> Time.zone = "Hawaii"
|
265
|
+
=> "Hawaii"
|
266
|
+
>> Time.zone.iso8601("1999-12-31")
|
267
|
+
=> Fri, 31 Dec 1999 00:00:00 HST -10:00
|
361
268
|
|
362
|
-
|
363
|
-
and
|
364
|
-
data from the ISO8601 gem redistributed under MIT license.
|
269
|
+
This new method has stricter semantics than the current `parse` method,
|
270
|
+
and will raise an `ArgumentError` instead of returning nil, e.g:
|
365
271
|
|
366
|
-
|
272
|
+
>> Time.zone = "Hawaii"
|
273
|
+
=> "Hawaii"
|
274
|
+
>> Time.zone.iso8601("foobar")
|
275
|
+
ArgumentError: invalid date
|
276
|
+
>> Time.zone.parse("foobar")
|
277
|
+
=> nil
|
367
278
|
|
368
|
-
*
|
279
|
+
*Andrew White*
|
369
280
|
|
370
|
-
*
|
371
|
-
with a block to provide a new value to cache. Fetching with `force: true`
|
372
|
-
but without a block now raises ArgumentError.
|
281
|
+
* Deprecate implicit coercion of `ActiveSupport::Duration`
|
373
282
|
|
374
|
-
|
283
|
+
Currently `ActiveSupport::Duration` implicitly converts to a seconds
|
284
|
+
value when used in a calculation except for the explicit examples of
|
285
|
+
addition and subtraction where the duration is the receiver, e.g:
|
375
286
|
|
376
|
-
|
287
|
+
>> 2 * 1.day
|
288
|
+
=> 172800
|
377
289
|
|
378
|
-
|
290
|
+
This results in lots of confusion especially when using durations
|
291
|
+
with dates because adding/subtracting a value from a date treats
|
292
|
+
integers as a day and not a second, e.g:
|
379
293
|
|
380
|
-
|
294
|
+
>> Date.today
|
295
|
+
=> Wed, 01 Mar 2017
|
296
|
+
>> Date.today + 2 * 1.day
|
297
|
+
=> Mon, 10 Apr 2490
|
381
298
|
|
382
|
-
|
299
|
+
To fix this we're implementing `coerce` so that we can provide a
|
300
|
+
deprecation warning with the intent of removing the implicit coercion
|
301
|
+
in Rails 5.2, e.g:
|
383
302
|
|
384
|
-
|
385
|
-
|
303
|
+
>> 2 * 1.day
|
304
|
+
DEPRECATION WARNING: Implicit coercion of ActiveSupport::Duration
|
305
|
+
to a Numeric is deprecated and will raise a TypeError in Rails 5.2.
|
306
|
+
=> 172800
|
386
307
|
|
387
|
-
|
308
|
+
In Rails 5.2 it will raise `TypeError`, e.g:
|
388
309
|
|
389
|
-
|
310
|
+
>> 2 * 1.day
|
311
|
+
TypeError: ActiveSupport::Duration can't be coerced into Integer
|
390
312
|
|
391
|
-
|
392
|
-
contain time information, but none that is used to build the `Time` object.
|
313
|
+
This is the same behavior as with other types in Ruby, e.g:
|
393
314
|
|
394
|
-
|
315
|
+
>> 2 * "foo"
|
316
|
+
TypeError: String can't be coerced into Integer
|
317
|
+
>> "foo" * 2
|
318
|
+
=> "foofoo"
|
395
319
|
|
396
|
-
|
320
|
+
As part of this deprecation add `*` and `/` methods to `AS::Duration`
|
321
|
+
so that calculations that keep the duration as the receiver work
|
322
|
+
correctly whether the final receiver is a `Date` or `Time`, e.g:
|
397
323
|
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
324
|
+
>> Date.today
|
325
|
+
=> Wed, 01 Mar 2017
|
326
|
+
>> Date.today + 1.day * 2
|
327
|
+
=> Fri, 03 Mar 2017
|
402
328
|
|
403
|
-
Fixes #
|
329
|
+
Fixes #27457.
|
404
330
|
|
405
331
|
*Andrew White*
|
406
332
|
|
407
|
-
*
|
408
|
-
|
409
|
-
*Glauco Custódio*, *bogdanvlviv*
|
410
|
-
|
411
|
-
* Prevent `Marshal.load` from looping infinitely when trying to autoload a constant
|
412
|
-
which resolves to a different name.
|
333
|
+
* Update `DateTime#change` to support `:usec` and `:nsec` options.
|
413
334
|
|
414
|
-
|
335
|
+
Adding support for these options now allows us to update the `DateTime#end_of`
|
336
|
+
methods to match the equivalent `Time#end_of` methods, e.g:
|
415
337
|
|
416
|
-
|
338
|
+
datetime = DateTime.now.end_of_day
|
339
|
+
datetime.nsec == 999999999 # => true
|
417
340
|
|
418
|
-
|
341
|
+
Fixes #21424.
|
419
342
|
|
420
|
-
*
|
421
|
-
components and libraries to manage, and participate in, the execution of
|
422
|
-
application code, and the application reloading process.
|
343
|
+
*Dan Moore*, *Andrew White*
|
423
344
|
|
424
|
-
|
345
|
+
* Add `ActiveSupport::Duration#before` and `#after` as aliases for `#until` and `#since`
|
425
346
|
|
426
|
-
|
347
|
+
These read more like English and require less mental gymnastics to read and write.
|
427
348
|
|
428
|
-
|
429
|
-
in (usually a specific exception class) since the method only yields the
|
430
|
-
block. So as not to confuse the users that the arguments have meaning, they
|
431
|
-
are being deprecated.
|
432
|
-
|
433
|
-
*Tara Scherner de la Fuente*
|
349
|
+
Before:
|
434
350
|
|
435
|
-
|
351
|
+
2.weeks.since(customer_start_date)
|
352
|
+
5.days.until(today)
|
436
353
|
|
437
|
-
|
354
|
+
After:
|
438
355
|
|
439
|
-
|
356
|
+
2.weeks.after(customer_start_date)
|
357
|
+
5.days.before(today)
|
440
358
|
|
441
|
-
|
442
|
-
or Sunday.
|
359
|
+
*Nick Johnstone*
|
443
360
|
|
444
|
-
|
361
|
+
* Soft-deprecated the top-level `HashWithIndifferentAccess` constant.
|
362
|
+
`ActiveSupport::HashWithIndifferentAccess` should be used instead.
|
445
363
|
|
446
|
-
|
364
|
+
Fixes #28157.
|
447
365
|
|
448
|
-
*
|
366
|
+
*Robin Dupret*
|
449
367
|
|
450
|
-
*
|
368
|
+
* In Core Extensions, make `MarshalWithAutoloading#load` pass through the second, optional
|
369
|
+
argument for `Marshal#load( source [, proc] )`. This way we don't have to do
|
370
|
+
`Marshal.method(:load).super_method.call(source, proc)` just to be able to pass a proc.
|
451
371
|
|
452
|
-
*
|
372
|
+
*Jeff Latz*
|
453
373
|
|
454
|
-
*
|
374
|
+
* `ActiveSupport::Gzip.decompress` now checks checksum and length in footer.
|
455
375
|
|
456
|
-
|
457
|
-
of a number in number_to_currency helper.
|
458
|
-
This change works same for all cases except when number is "-0.0".
|
376
|
+
*Dylan Thacker-Smith*
|
459
377
|
|
460
|
-
|
461
|
-
-0.0.to_f.phase? => 3.14
|
378
|
+
* Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing.
|
462
379
|
|
463
|
-
|
464
|
-
But it should be acceptable as we could not find any currency which
|
465
|
-
supports negative zeros.
|
380
|
+
*Adam Rice*
|
466
381
|
|
467
|
-
|
382
|
+
* Deprecate `ActiveSupport.halt_callback_chains_on_return_false`.
|
468
383
|
|
469
|
-
*
|
384
|
+
*Rafael Mendonça França*
|
470
385
|
|
471
|
-
|
386
|
+
* Remove deprecated behavior that halts callbacks when the return is false.
|
472
387
|
|
473
|
-
*
|
474
|
-
payload when an exception is raised.
|
388
|
+
*Rafael Mendonça França*
|
475
389
|
|
476
|
-
|
477
|
-
|
390
|
+
* Deprecate passing string to `:if` and `:unless` conditional options
|
391
|
+
on `set_callback` and `skip_callback`.
|
478
392
|
|
479
|
-
*
|
393
|
+
*Ryuta Kamizono*
|
480
394
|
|
481
|
-
*
|
395
|
+
* Raise `ArgumentError` when passing string to define callback.
|
482
396
|
|
483
|
-
*
|
397
|
+
*Ryuta Kamizono*
|
484
398
|
|
485
|
-
*
|
399
|
+
* Updated Unicode version to 9.0.0
|
486
400
|
|
487
|
-
|
401
|
+
Now we can handle new emojis such like "👩👩👧👦" ("\u{1F469}\u{200D}\u{1F469}\u{200D}\u{1F467}\u{200D}\u{1F466}").
|
488
402
|
|
489
|
-
|
490
|
-
This makes it easy to declare per-thread globals that are encapsulated. Note: This is a sharp edge. A wild proliferation
|
491
|
-
of globals is A Bad Thing. But like other sharp tools, when it's right, it's right.
|
403
|
+
version 8.0.0
|
492
404
|
|
493
|
-
|
494
|
-
|
405
|
+
"👩👩👧👦".mb_chars.grapheme_length # => 4
|
406
|
+
"👩👩👧👦".mb_chars.reverse # => "👦👧👩👩"
|
495
407
|
|
496
|
-
|
497
|
-
thread_mattr_accessor :account
|
498
|
-
thread_mattr_accessor :user
|
408
|
+
version 9.0.0
|
499
409
|
|
500
|
-
|
501
|
-
|
410
|
+
"👩👩👧👦".mb_chars.grapheme_length # => 1
|
411
|
+
"👩👩👧👦".mb_chars.reverse # => "👩👩👧👦"
|
502
412
|
|
503
|
-
|
504
|
-
before_action :set_current
|
505
|
-
after_action { Current.reset }
|
413
|
+
*Fumiaki MATSUSHIMA*
|
506
414
|
|
507
|
-
|
508
|
-
|
509
|
-
Current.account = Account.find(params[:account_id])
|
510
|
-
Current.user = Current.account.users.find(params[:user_id])
|
511
|
-
end
|
512
|
-
end
|
415
|
+
* Changed `ActiveSupport::Inflector#transliterate` to raise `ArgumentError` when it receives
|
416
|
+
anything except a string.
|
513
417
|
|
514
|
-
|
515
|
-
def create
|
516
|
-
@message = Message.create!(message_params)
|
517
|
-
end
|
518
|
-
end
|
418
|
+
*Kevin McPhillips*
|
519
419
|
|
520
|
-
|
521
|
-
|
522
|
-
after_create :track_created
|
420
|
+
* Fixed bugs that `StringInquirer#respond_to_missing?` and
|
421
|
+
`ArrayInquirer#respond_to_missing?` do not fallback to `super`.
|
523
422
|
|
524
|
-
|
525
|
-
def track_created
|
526
|
-
events.create! origin: self, action: :create
|
527
|
-
end
|
528
|
-
end
|
529
|
-
|
530
|
-
class Event < ApplicationRecord
|
531
|
-
belongs_to :creator, class_name: 'User'
|
532
|
-
before_validation { self.creator ||= Current.user }
|
533
|
-
end
|
534
|
-
|
535
|
-
*DHH*
|
536
|
-
|
537
|
-
|
538
|
-
* Deprecated `Module#qualified_const_` in favour of the builtin Module#const_
|
539
|
-
methods.
|
423
|
+
*Akira Matsuda*
|
540
424
|
|
541
|
-
|
425
|
+
* Fix inconsistent results when parsing large durations and constructing durations from code
|
542
426
|
|
543
|
-
|
427
|
+
ActiveSupport::Duration.parse('P3Y') == 3.years # It should be true
|
544
428
|
|
545
|
-
|
429
|
+
Duration parsing made independent from any moment of time:
|
430
|
+
Fixed length in seconds is assigned to each duration part during parsing.
|
546
431
|
|
547
|
-
|
548
|
-
`ActiveSupport::Cache::MemCachedStore#escape_key`, and
|
549
|
-
`ActiveSupport::Cache::FileStore#key_file_path`
|
550
|
-
are deprecated and replaced with `normalize_key` that now calls `super`.
|
432
|
+
Changed duration of months and years in seconds to more accurate and logical:
|
551
433
|
|
552
|
-
|
434
|
+
1. The value of 365.2425 days in Gregorian year is more accurate
|
435
|
+
as it accounts for every 400th non-leap year.
|
553
436
|
|
554
|
-
|
437
|
+
2. Month's length is bound to year's duration, which makes
|
438
|
+
sensible comparisons like `12.months == 1.year` to be `true`
|
439
|
+
and nonsensical ones like `30.days == 1.month` to be `false`.
|
555
440
|
|
556
|
-
|
557
|
-
|
441
|
+
Calculations on times and dates with durations shouldn't be affected as
|
442
|
+
duration's numeric value isn't used in calculations, only parts are used.
|
558
443
|
|
559
|
-
|
444
|
+
Methods on `Numeric` like `2.days` now use these predefined durations
|
445
|
+
to avoid duplication of duration constants through the codebase and
|
446
|
+
eliminate creation of intermediate durations.
|
560
447
|
|
561
|
-
|
562
|
-
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
448
|
+
*Andrey Novikov*, *Andrew White*
|
563
449
|
|
564
|
-
|
450
|
+
* Change return value of `Rational#duplicable?`, `ComplexClass#duplicable?`
|
451
|
+
to false.
|
565
452
|
|
566
|
-
|
567
|
-
gem 'listen', '~> 3.0.5'
|
568
|
-
end
|
453
|
+
*utilum*
|
569
454
|
|
570
|
-
|
455
|
+
* Change return value of `NilClass#duplicable?`, `FalseClass#duplicable?`,
|
456
|
+
`TrueClass#duplicable?`, `Symbol#duplicable?` and `Numeric#duplicable?`
|
457
|
+
to true with Ruby 2.4+. These classes can dup with Ruby 2.4+.
|
571
458
|
|
572
|
-
*
|
573
|
-
current year if no argument is provided.
|
459
|
+
*Yuji Yaginuma*
|
574
460
|
|
575
|
-
|
461
|
+
* Remove deprecated class `ActiveSupport::Concurrency::Latch`.
|
576
462
|
|
577
|
-
*
|
463
|
+
*Andrew White*
|
578
464
|
|
579
|
-
|
465
|
+
* Remove deprecated separator argument from `parameterize`.
|
580
466
|
|
581
|
-
|
582
|
-
parameterize("Donald E. Knuth", preserve_case: true) # => "Donald-E-Knuth"
|
467
|
+
*Andrew White*
|
583
468
|
|
584
|
-
|
469
|
+
* Remove deprecated method `Numeric#to_formatted_s`.
|
585
470
|
|
586
|
-
*
|
587
|
-
that respond to `#to_hash`. `.new_from_hash_copying_default` simply invokes `.new`.
|
588
|
-
All calls to `.new_from_hash_copying_default` are replaced with `.new`.
|
471
|
+
*Andrew White*
|
589
472
|
|
590
|
-
|
473
|
+
* Remove deprecated method `alias_method_chain`.
|
591
474
|
|
592
|
-
*
|
593
|
-
consistency.
|
475
|
+
*Andrew White*
|
594
476
|
|
595
|
-
|
596
|
-
(days, weeks, months, etc.) return a Fixnum.
|
477
|
+
* Remove deprecated constant `MissingSourceFile`.
|
597
478
|
|
598
|
-
|
479
|
+
*Andrew White*
|
599
480
|
|
600
|
-
|
481
|
+
* Remove deprecated methods `Module.qualified_const_defined?`,
|
482
|
+
`Module.qualified_const_get` and `Module.qualified_const_set`.
|
601
483
|
|
602
|
-
|
484
|
+
*Andrew White*
|
603
485
|
|
604
|
-
|
486
|
+
* Remove deprecated `:prefix` option from `number_to_human_size`.
|
605
487
|
|
606
|
-
*
|
488
|
+
*Andrew White*
|
607
489
|
|
608
|
-
*
|
490
|
+
* Remove deprecated method `ActiveSupport::HashWithIndifferentAccess.new_from_hash_copying_default`.
|
609
491
|
|
610
|
-
|
611
|
-
strings in `ERB::Util.unwrapped_html_escape` and `ERB::Util.html_escape_once`.
|
612
|
-
Prevents user-entered input passed from a querystring into a form field from
|
613
|
-
causing invalid byte sequence errors.
|
492
|
+
*Andrew White*
|
614
493
|
|
615
|
-
|
494
|
+
* Remove deprecated file `active_support/core_ext/time/marshal.rb`.
|
616
495
|
|
617
|
-
*
|
618
|
-
arguments are out of bounds, to mirror the behavior of `String#slice!`
|
496
|
+
*Andrew White*
|
619
497
|
|
620
|
-
|
498
|
+
* Remove deprecated file `active_support/core_ext/struct.rb`.
|
621
499
|
|
622
|
-
*
|
623
|
-
"1000 Million".
|
500
|
+
*Andrew White*
|
624
501
|
|
625
|
-
|
502
|
+
* Remove deprecated file `active_support/core_ext/module/method_transplanting.rb`.
|
626
503
|
|
627
|
-
*
|
628
|
-
current deprecator instance, where applicable.
|
504
|
+
*Andrew White*
|
629
505
|
|
630
|
-
|
506
|
+
* Remove deprecated method `Module.local_constants`.
|
631
507
|
|
632
|
-
*
|
508
|
+
*Andrew White*
|
633
509
|
|
634
|
-
|
510
|
+
* Remove deprecated file `active_support/core_ext/kernel/debugger.rb`.
|
635
511
|
|
636
|
-
*
|
637
|
-
yielded block.
|
512
|
+
*Andrew White*
|
638
513
|
|
639
|
-
|
514
|
+
* Remove deprecated method `ActiveSupport::Cache::Store#namespaced_key`.
|
640
515
|
|
641
|
-
|
642
|
-
Post.create
|
643
|
-
end
|
516
|
+
*Andrew White*
|
644
517
|
|
645
|
-
|
518
|
+
* Remove deprecated method `ActiveSupport::Cache::Strategy::LocalCache::LocalStore#set_cache_value`.
|
646
519
|
|
647
|
-
*
|
520
|
+
*Andrew White*
|
648
521
|
|
649
|
-
|
522
|
+
* Remove deprecated method `ActiveSupport::Cache::MemCacheStore#escape_key`.
|
650
523
|
|
651
524
|
*Andrew White*
|
652
525
|
|
653
|
-
*
|
654
|
-
the thread_safe gem has been merged into concurrent-ruby.
|
655
|
-
|
656
|
-
*Jerry D'Antonio*
|
526
|
+
* Remove deprecated method `ActiveSupport::Cache::FileStore#key_file_path`.
|
657
527
|
|
658
|
-
*
|
528
|
+
*Andrew White*
|
659
529
|
|
660
|
-
|
530
|
+
* Ensure duration parsing is consistent across DST changes.
|
661
531
|
|
662
|
-
|
663
|
-
|
532
|
+
Previously `ActiveSupport::Duration.parse` used `Time.current` and
|
533
|
+
`Time#advance` to calculate the number of seconds in the duration
|
534
|
+
from an arbitrary collection of parts. However as `advance` tries to
|
535
|
+
be consistent across DST boundaries this meant that either the
|
536
|
+
duration was shorter or longer depending on the time of year.
|
664
537
|
|
665
|
-
|
538
|
+
This was fixed by using an absolute reference point in UTC which
|
539
|
+
isn't subject to DST transitions. An arbitrary date of Jan 1st, 2000
|
540
|
+
was chosen for no other reason that it seemed appropriate.
|
666
541
|
|
667
|
-
|
668
|
-
|
542
|
+
Additionally, duration parsing should now be marginally faster as we
|
543
|
+
are no longer creating instances of `ActiveSupport::TimeWithZone`
|
544
|
+
every time we parse a duration string.
|
669
545
|
|
670
|
-
|
546
|
+
Fixes #26941.
|
671
547
|
|
672
|
-
*
|
548
|
+
*Andrew White*
|
673
549
|
|
674
|
-
|
550
|
+
* Use `Hash#compact` and `Hash#compact!` from Ruby 2.4. Old Ruby versions
|
551
|
+
will continue to get these methods from Active Support as before.
|
675
552
|
|
676
|
-
*
|
677
|
-
twz = DateTime.now.in_time_zone
|
678
|
-
twz.eql?(twz.dup) => true
|
553
|
+
*Prathamesh Sonpatki*
|
679
554
|
|
680
|
-
|
555
|
+
* Fix `ActiveSupport::TimeZone#strptime`.
|
556
|
+
Support for timestamps in format of seconds (%s) and milliseconds (%Q).
|
681
557
|
|
682
|
-
|
558
|
+
Fixes #26840.
|
683
559
|
|
684
|
-
*
|
685
|
-
enumerator if called without block.
|
560
|
+
*Lev Denisov*
|
686
561
|
|
687
|
-
|
562
|
+
* Fix `DateAndTime::Calculations#copy_time_to`. Copy `nsec` instead of `usec`.
|
688
563
|
|
689
|
-
|
564
|
+
Jumping forward or backward between weeks now preserves nanosecond digits.
|
690
565
|
|
691
|
-
*
|
692
|
-
from the concurrent-ruby gem.
|
566
|
+
*Josua Schmid*
|
693
567
|
|
694
|
-
|
568
|
+
* Fix `ActiveSupport::TimeWithZone#in` across DST boundaries.
|
695
569
|
|
696
|
-
|
697
|
-
`
|
570
|
+
Previously calls to `in` were being sent to the non-DST aware
|
571
|
+
method `Time#since` via `method_missing`. It is now aliased to
|
572
|
+
the DST aware `ActiveSupport::TimeWithZone#+` which handles
|
573
|
+
transitions across DST boundaries, e.g:
|
698
574
|
|
699
|
-
|
575
|
+
Time.zone = "US/Eastern"
|
700
576
|
|
701
|
-
|
577
|
+
t = Time.zone.local(2016,11,6,1)
|
578
|
+
# => Sun, 06 Nov 2016 01:00:00 EDT -05:00
|
702
579
|
|
703
|
-
|
580
|
+
t.in(1.hour)
|
581
|
+
# => Sun, 06 Nov 2016 01:00:00 EST -05:00
|
704
582
|
|
705
|
-
|
583
|
+
Fixes #26580.
|
706
584
|
|
707
|
-
*
|
585
|
+
*Thomas Balthazar*
|
708
586
|
|
709
|
-
*
|
710
|
-
|
587
|
+
* Remove unused parameter `options = nil` for `#clear` of
|
588
|
+
`ActiveSupport::Cache::Strategy::LocalCache::LocalStore` and
|
589
|
+
`ActiveSupport::Cache::Strategy::LocalCache`.
|
711
590
|
|
712
|
-
|
591
|
+
*Yosuke Kabuto*
|
713
592
|
|
714
|
-
|
593
|
+
* Fix `thread_mattr_accessor` subclass no longer overwrites parent.
|
715
594
|
|
716
|
-
|
717
|
-
|
595
|
+
Assigning a value to a subclass using `thread_mattr_accessor` no
|
596
|
+
longer changes the value of the parent class. This brings the
|
597
|
+
behavior inline with the documentation.
|
718
598
|
|
719
|
-
|
599
|
+
Given:
|
720
600
|
|
721
|
-
|
722
|
-
|
723
|
-
else
|
724
|
-
# Raise as important secret password is not specified
|
601
|
+
class Account
|
602
|
+
thread_mattr_accessor :user
|
725
603
|
end
|
726
604
|
|
727
|
-
|
728
|
-
|
729
|
-
slack_url = Rails.application.secrets.slack_url!
|
730
|
-
|
731
|
-
*Aditya Sanghi*, *Gaurish Sharma*
|
732
|
-
|
733
|
-
* Remove deprecated `Class#superclass_delegating_accessor`.
|
734
|
-
Use `Class#class_attribute` instead.
|
735
|
-
|
736
|
-
*Akshay Vishnoi*
|
737
|
-
|
738
|
-
* Patch `Delegator` to work with `#try`.
|
739
|
-
|
740
|
-
Fixes #5790.
|
741
|
-
|
742
|
-
*Nate Smith*
|
743
|
-
|
744
|
-
* Add `Integer#positive?` and `Integer#negative?` query methods
|
745
|
-
in the vein of `Fixnum#zero?`.
|
746
|
-
|
747
|
-
This makes it nicer to do things like `bunch_of_numbers.select(&:positive?)`.
|
748
|
-
|
749
|
-
*DHH*
|
750
|
-
|
751
|
-
* Encoding `ActiveSupport::TimeWithZone` to YAML now preserves the timezone information.
|
752
|
-
|
753
|
-
Fixes #9183.
|
754
|
-
|
755
|
-
*Andrew White*
|
756
|
-
|
757
|
-
* Added `ActiveSupport::TimeZone#strptime` to allow parsing times as if
|
758
|
-
from a given timezone.
|
759
|
-
|
760
|
-
*Paul A Jungwirth*
|
761
|
-
|
762
|
-
* `ActiveSupport::Callbacks#skip_callback` now raises an `ArgumentError` if
|
763
|
-
an unrecognized callback is removed.
|
764
|
-
|
765
|
-
*Iain Beeston*
|
766
|
-
|
767
|
-
* Added `ActiveSupport::ArrayInquirer` and `Array#inquiry`.
|
768
|
-
|
769
|
-
Wrapping an array in an `ArrayInquirer` gives a friendlier way to check its
|
770
|
-
contents:
|
771
|
-
|
772
|
-
variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet])
|
773
|
-
|
774
|
-
variants.phone? # => true
|
775
|
-
variants.tablet? # => true
|
776
|
-
variants.desktop? # => false
|
777
|
-
|
778
|
-
variants.any?(:phone, :tablet) # => true
|
779
|
-
variants.any?(:phone, :desktop) # => true
|
780
|
-
variants.any?(:desktop, :watch) # => false
|
781
|
-
|
782
|
-
`Array#inquiry` is a shortcut for wrapping the receiving array in an
|
783
|
-
`ArrayInquirer`.
|
784
|
-
|
785
|
-
*George Claghorn*
|
786
|
-
|
787
|
-
* Deprecate `alias_method_chain` in favour of `Module#prepend` introduced in
|
788
|
-
Ruby 2.0.
|
789
|
-
|
790
|
-
*Kir Shatrov*
|
791
|
-
|
792
|
-
* Added `#without` on `Enumerable` and `Array` to return a copy of an
|
793
|
-
enumerable without the specified elements.
|
794
|
-
|
795
|
-
*Todd Bealmear*
|
796
|
-
|
797
|
-
* Fixed a problem where `String#truncate_words` would get stuck with a complex
|
798
|
-
string.
|
799
|
-
|
800
|
-
*Henrik Nygren*
|
605
|
+
class Customer < Account
|
606
|
+
end
|
801
607
|
|
802
|
-
|
803
|
-
|
608
|
+
Account.user = "DHH"
|
609
|
+
Customer.user = "Rafael"
|
804
610
|
|
805
611
|
Before:
|
806
612
|
|
807
|
-
|
808
|
-
YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => true
|
809
|
-
YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => false
|
810
|
-
YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => 1
|
811
|
-
YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => 1.1
|
613
|
+
Account.user # => "Rafael"
|
812
614
|
|
813
615
|
After:
|
814
616
|
|
815
|
-
|
816
|
-
YAML.load ActiveSupport::SafeBuffer.new("true").to_yaml # => "true"
|
817
|
-
YAML.load ActiveSupport::SafeBuffer.new("false").to_yaml # => "false"
|
818
|
-
YAML.load ActiveSupport::SafeBuffer.new("1").to_yaml # => "1"
|
819
|
-
YAML.load ActiveSupport::SafeBuffer.new("1.1").to_yaml # => "1.1"
|
820
|
-
|
821
|
-
*Godfrey Chan*
|
822
|
-
|
823
|
-
* Enable `number_to_percentage` to keep the number's precision by allowing
|
824
|
-
`:precision` to be `nil`.
|
825
|
-
|
826
|
-
*Jack Xu*
|
827
|
-
|
828
|
-
* `config_accessor` became a private method, as with Ruby's `attr_accessor`.
|
829
|
-
|
830
|
-
*Akira Matsuda*
|
831
|
-
|
832
|
-
* `AS::Testing::TimeHelpers#travel_to` now changes `DateTime.now` as well as
|
833
|
-
`Time.now` and `Date.today`.
|
834
|
-
|
835
|
-
*Yuki Nishijima*
|
836
|
-
|
837
|
-
* Add `file_fixture` to `ActiveSupport::TestCase`.
|
838
|
-
It provides a simple mechanism to access sample files in your test cases.
|
839
|
-
|
840
|
-
By default file fixtures are stored in `test/fixtures/files`. This can be
|
841
|
-
configured per test-case using the `file_fixture_path` class attribute.
|
842
|
-
|
843
|
-
*Yves Senn*
|
844
|
-
|
845
|
-
* Return value of yielded block in `File.atomic_write`.
|
846
|
-
|
847
|
-
*Ian Ker-Seymer*
|
848
|
-
|
849
|
-
* Duplicate frozen array when assigning it to a `HashWithIndifferentAccess` so
|
850
|
-
that it doesn't raise a `RuntimeError` when calling `map!` on it in `convert_value`.
|
851
|
-
|
852
|
-
Fixes #18550.
|
853
|
-
|
854
|
-
*Aditya Kapoor*
|
855
|
-
|
856
|
-
* Add missing time zone definitions for Russian Federation and sync them
|
857
|
-
with `zone.tab` file from tzdata version 2014j (latest).
|
858
|
-
|
859
|
-
*Andrey Novikov*
|
860
|
-
|
861
|
-
* Add `SecureRandom.base58` for generation of random base58 strings.
|
862
|
-
|
863
|
-
*Matthew Draper*, *Guillermo Iguaran*
|
617
|
+
Account.user # => "DHH"
|
864
618
|
|
865
|
-
*
|
866
|
-
`#tomorrow` for `Date`, `Time`, and `DateTime`.
|
619
|
+
*Shinichi Maeshima*
|
867
620
|
|
868
|
-
|
621
|
+
* Since weeks are no longer converted to days, add `:weeks` to the list of
|
622
|
+
parts that `ActiveSupport::TimeWithZone` will recognize as possibly being
|
623
|
+
of variable duration to take account of DST transitions.
|
869
624
|
|
870
|
-
|
871
|
-
and `DateTime`.
|
625
|
+
Fixes #26039.
|
872
626
|
|
873
|
-
*
|
627
|
+
*Andrew White*
|
874
628
|
|
875
|
-
*
|
876
|
-
|
629
|
+
* Defines `Regexp.match?` for Ruby versions prior to 2.4. The predicate
|
630
|
+
has the same interface, but it does not have the performance boost. Its
|
631
|
+
purpose is to be able to write 2.4 compatible code.
|
877
632
|
|
878
|
-
|
879
|
-
or Sunday.
|
633
|
+
*Xavier Noria*
|
880
634
|
|
881
|
-
|
882
|
-
not fall on a Saturday or Sunday.
|
635
|
+
* Allow `MessageEncryptor` to take advantage of authenticated encryption modes.
|
883
636
|
|
884
|
-
|
885
|
-
|
637
|
+
AEAD modes like `aes-256-gcm` provide both confidentiality and data
|
638
|
+
authenticity, eliminating the need to use `MessageVerifier` to check if the
|
639
|
+
encrypted data has been tampered with. This speeds up encryption/decryption
|
640
|
+
and results in shorter cipher text.
|
886
641
|
|
887
|
-
*
|
642
|
+
*Bart de Water*
|
888
643
|
|
889
|
-
*
|
890
|
-
so that they don't share tags with each other.
|
644
|
+
* Introduce `assert_changes` and `assert_no_changes`.
|
891
645
|
|
892
|
-
|
646
|
+
`assert_changes` is a more general `assert_difference` that works with any
|
647
|
+
value.
|
893
648
|
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
custom_logger.info "test" # => "[custom_tag] [custom_tag] test"
|
898
|
-
Rails.logger.info "test" # => "[custom_tag] [custom_tag] test"
|
649
|
+
assert_changes 'Error.current', from: nil, to: 'ERR' do
|
650
|
+
expected_bad_operation
|
651
|
+
end
|
899
652
|
|
900
|
-
|
901
|
-
|
902
|
-
custom_logger.push_tags "custom_tag"
|
903
|
-
custom_logger.info "test" # => "[custom_tag] test"
|
904
|
-
Rails.logger.info "test" # => "test"
|
653
|
+
Can be called with strings, to be evaluated in the binding (context) of
|
654
|
+
the block given to the assertion, or a lambda.
|
905
655
|
|
906
|
-
|
656
|
+
assert_changes -> { Error.current }, from: nil, to: 'ERR' do
|
657
|
+
expected_bad_operation
|
658
|
+
end
|
907
659
|
|
908
|
-
|
660
|
+
The `from` and `to` arguments are compared with the case operator (`===`).
|
909
661
|
|
910
|
-
|
662
|
+
assert_changes 'Error.current', from: nil, to: Error do
|
663
|
+
expected_bad_operation
|
664
|
+
end
|
911
665
|
|
912
|
-
|
666
|
+
This is pretty useful, if you need to loosely compare a value. For example,
|
667
|
+
you need to test a token has been generated and it has that many random
|
668
|
+
characters.
|
913
669
|
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
670
|
+
user = User.start_registration
|
671
|
+
assert_changes 'user.token', to: /\w{32}/ do
|
672
|
+
user.finish_registration
|
673
|
+
end
|
918
674
|
|
919
|
-
*
|
675
|
+
*Genadi Samokovarov*
|
920
676
|
|
921
|
-
*
|
677
|
+
* Fix `ActiveSupport::TimeZone#strptime`. Now raises `ArgumentError` when the
|
678
|
+
given time doesn't match the format. The error is the same as the one given
|
679
|
+
by Ruby's `Date.strptime`. Previously it raised
|
680
|
+
`NoMethodError: undefined method empty? for nil:NilClass.` due to a bug.
|
922
681
|
|
923
|
-
|
682
|
+
Fixes #25701.
|
924
683
|
|
925
|
-
*
|
684
|
+
*John Gesimondo*
|
926
685
|
|
927
|
-
|
686
|
+
* `travel/travel_to` travel time helpers, now raise on nested calls,
|
687
|
+
as this can lead to confusing time stubbing.
|
928
688
|
|
929
|
-
|
689
|
+
Instead of:
|
930
690
|
|
931
|
-
|
932
|
-
|
691
|
+
travel_to 2.days.from_now do
|
692
|
+
# 2 days from today
|
693
|
+
travel_to 3.days.from_now do
|
694
|
+
# 5 days from today
|
695
|
+
end
|
696
|
+
end
|
933
697
|
|
934
|
-
|
698
|
+
preferred way to achieve above is:
|
935
699
|
|
936
|
-
|
937
|
-
|
700
|
+
travel 2.days do
|
701
|
+
# 2 days from today
|
702
|
+
end
|
938
703
|
|
939
|
-
|
704
|
+
travel 5.days do
|
705
|
+
# 5 days from today
|
706
|
+
end
|
940
707
|
|
941
|
-
*
|
708
|
+
*Vipul A M*
|
942
709
|
|
943
|
-
|
944
|
-
`
|
945
|
-
|
946
|
-
|
710
|
+
* Support parsing JSON time in ISO8601 local time strings in
|
711
|
+
`ActiveSupport::JSON.decode` when `parse_json_times` is enabled.
|
712
|
+
Strings in the format of `YYYY-MM-DD hh:mm:ss` (without a `Z` at
|
713
|
+
the end) will be parsed in the local timezone (`Time.zone`). In
|
714
|
+
addition, date strings (`YYYY-MM-DD`) are now parsed into `Date`
|
715
|
+
objects.
|
947
716
|
|
948
|
-
*
|
717
|
+
*Grzegorz Witek*
|
949
718
|
|
950
|
-
|
951
|
-
|
952
|
-
|
719
|
+
* Fixed `ActiveSupport::Logger.broadcast` so that calls to `#silence` now
|
720
|
+
properly delegate to all loggers. Silencing now properly suppresses logging
|
721
|
+
to both the log and the console.
|
953
722
|
|
954
|
-
|
955
|
-
returned by those callbacks, and only halt the chain upon `throw(:abort)`.
|
723
|
+
*Kevin McPhillips*
|
956
724
|
|
957
|
-
|
958
|
-
ported to Rails 5.0 will not break (but display a deprecation warning).
|
959
|
-
For new Rails 5.0 apps, its value is set to `false` in an initializer, so
|
960
|
-
these apps will support the new behavior by default.
|
725
|
+
* Remove deprecated arguments in `assert_nothing_raised`.
|
961
726
|
|
962
|
-
*
|
727
|
+
*Rafel Mendonça França*
|
963
728
|
|
964
|
-
*
|
729
|
+
* `Date.to_s` doesn't produce too many spaces. For example, `to_s(:short)`
|
730
|
+
will now produce `01 Feb` instead of ` 1 Feb`.
|
965
731
|
|
966
|
-
|
967
|
-
now be halted as soon as a `before_` callback throws `:abort`.
|
732
|
+
Fixes #25251.
|
968
733
|
|
969
|
-
|
970
|
-
existing behavior of halting as soon as a `before_` callback matches the
|
971
|
-
terminator's expectation.
|
734
|
+
*Sean Griffin*
|
972
735
|
|
973
|
-
|
736
|
+
* Introduce `Module#delegate_missing_to`.
|
974
737
|
|
975
|
-
|
738
|
+
When building a decorator, a common pattern emerges:
|
976
739
|
|
977
|
-
|
978
|
-
|
740
|
+
class Partition
|
741
|
+
def initialize(first_event)
|
742
|
+
@events = [ first_event ]
|
743
|
+
end
|
979
744
|
|
980
|
-
|
745
|
+
def people
|
746
|
+
if @events.first.detail.people.any?
|
747
|
+
@events.collect { |e| Array(e.detail.people) }.flatten.uniq
|
748
|
+
else
|
749
|
+
@events.collect(&:creator).uniq
|
750
|
+
end
|
751
|
+
end
|
981
752
|
|
982
|
-
|
753
|
+
private
|
754
|
+
def respond_to_missing?(name, include_private = false)
|
755
|
+
@events.respond_to?(name, include_private)
|
756
|
+
end
|
983
757
|
|
984
|
-
|
758
|
+
def method_missing(method, *args, &block)
|
759
|
+
@events.send(method, *args, &block)
|
760
|
+
end
|
761
|
+
end
|
985
762
|
|
986
|
-
|
987
|
-
Now it acts closer to Ruby's rescue.
|
763
|
+
With `Module#delegate_missing_to`, the above is condensed to:
|
988
764
|
|
989
|
-
|
765
|
+
class Partition
|
766
|
+
delegate_missing_to :@events
|
990
767
|
|
991
|
-
|
992
|
-
|
993
|
-
def self.===(other)
|
994
|
-
Exception === other && other.respond_to?(:status)
|
995
|
-
end
|
768
|
+
def initialize(first_event)
|
769
|
+
@events = [ first_event ]
|
996
770
|
end
|
997
771
|
|
998
|
-
|
999
|
-
|
772
|
+
def people
|
773
|
+
if @events.first.detail.people.any?
|
774
|
+
@events.collect { |e| Array(e.detail.people) }.flatten.uniq
|
775
|
+
else
|
776
|
+
@events.collect(&:creator).uniq
|
777
|
+
end
|
1000
778
|
end
|
1001
779
|
end
|
1002
780
|
|
1003
|
-
*Genadi Samokovarov*
|
781
|
+
*Genadi Samokovarov*, *DHH*
|
1004
782
|
|
1005
|
-
*
|
1006
|
-
|
1007
|
-
Previously, the only way to decode a message with `ActiveSupport::MessageVerifier`
|
1008
|
-
was to use `#verify`, which would raise an exception on invalid messages. Now
|
1009
|
-
`#verified` can also be used, which returns `nil` on messages that cannot be
|
1010
|
-
decoded.
|
1011
|
-
|
1012
|
-
Previously, there was no way to check if a message's format was valid without
|
1013
|
-
attempting to decode it. `#valid_message?` is a boolean convenience method that
|
1014
|
-
checks whether the message is valid without actually decoding it.
|
783
|
+
* Rescuable: If a handler doesn't match the exception, check for handlers
|
784
|
+
matching the exception's cause.
|
1015
785
|
|
1016
|
-
*
|
786
|
+
*Jeremy Daer*
|
1017
787
|
|
1018
|
-
Please check [
|
788
|
+
Please check [5-0-stable](https://github.com/rails/rails/blob/5-0-stable/activesupport/CHANGELOG.md) for previous changes.
|