activesupport 6.0.0
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 +7 -0
- data/CHANGELOG.md +572 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +40 -0
- data/lib/active_support.rb +96 -0
- data/lib/active_support/actionable_error.rb +48 -0
- data/lib/active_support/all.rb +5 -0
- data/lib/active_support/array_inquirer.rb +48 -0
- data/lib/active_support/backtrace_cleaner.rb +132 -0
- data/lib/active_support/benchmarkable.rb +51 -0
- data/lib/active_support/builder.rb +8 -0
- data/lib/active_support/cache.rb +830 -0
- data/lib/active_support/cache/file_store.rb +196 -0
- data/lib/active_support/cache/mem_cache_store.rb +212 -0
- data/lib/active_support/cache/memory_store.rb +174 -0
- data/lib/active_support/cache/null_store.rb +48 -0
- data/lib/active_support/cache/redis_cache_store.rb +488 -0
- data/lib/active_support/cache/strategy/local_cache.rb +194 -0
- data/lib/active_support/cache/strategy/local_cache_middleware.rb +45 -0
- data/lib/active_support/callbacks.rb +856 -0
- data/lib/active_support/concern.rb +171 -0
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +17 -0
- data/lib/active_support/concurrency/share_lock.rb +227 -0
- data/lib/active_support/configurable.rb +146 -0
- data/lib/active_support/core_ext.rb +5 -0
- data/lib/active_support/core_ext/array.rb +9 -0
- data/lib/active_support/core_ext/array/access.rb +104 -0
- data/lib/active_support/core_ext/array/conversions.rb +213 -0
- data/lib/active_support/core_ext/array/extract.rb +21 -0
- data/lib/active_support/core_ext/array/extract_options.rb +31 -0
- data/lib/active_support/core_ext/array/grouping.rb +109 -0
- data/lib/active_support/core_ext/array/inquiry.rb +19 -0
- data/lib/active_support/core_ext/array/prepend_and_append.rb +5 -0
- data/lib/active_support/core_ext/array/wrap.rb +48 -0
- data/lib/active_support/core_ext/benchmark.rb +16 -0
- data/lib/active_support/core_ext/big_decimal.rb +3 -0
- data/lib/active_support/core_ext/big_decimal/conversions.rb +14 -0
- data/lib/active_support/core_ext/class.rb +4 -0
- data/lib/active_support/core_ext/class/attribute.rb +141 -0
- data/lib/active_support/core_ext/class/attribute_accessors.rb +6 -0
- data/lib/active_support/core_ext/class/subclasses.rb +54 -0
- data/lib/active_support/core_ext/date.rb +7 -0
- data/lib/active_support/core_ext/date/acts_like.rb +10 -0
- data/lib/active_support/core_ext/date/blank.rb +14 -0
- data/lib/active_support/core_ext/date/calculations.rb +146 -0
- data/lib/active_support/core_ext/date/conversions.rb +96 -0
- data/lib/active_support/core_ext/date/zones.rb +8 -0
- data/lib/active_support/core_ext/date_and_time/calculations.rb +351 -0
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +16 -0
- data/lib/active_support/core_ext/date_and_time/zones.rb +41 -0
- data/lib/active_support/core_ext/date_time.rb +7 -0
- data/lib/active_support/core_ext/date_time/acts_like.rb +16 -0
- data/lib/active_support/core_ext/date_time/blank.rb +14 -0
- data/lib/active_support/core_ext/date_time/calculations.rb +211 -0
- data/lib/active_support/core_ext/date_time/compatibility.rb +18 -0
- data/lib/active_support/core_ext/date_time/conversions.rb +107 -0
- data/lib/active_support/core_ext/digest.rb +3 -0
- data/lib/active_support/core_ext/digest/uuid.rb +53 -0
- data/lib/active_support/core_ext/enumerable.rb +188 -0
- data/lib/active_support/core_ext/file.rb +3 -0
- data/lib/active_support/core_ext/file/atomic.rb +70 -0
- data/lib/active_support/core_ext/hash.rb +10 -0
- data/lib/active_support/core_ext/hash/compact.rb +5 -0
- data/lib/active_support/core_ext/hash/conversions.rb +263 -0
- data/lib/active_support/core_ext/hash/deep_merge.rb +34 -0
- data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
- data/lib/active_support/core_ext/hash/except.rb +24 -0
- data/lib/active_support/core_ext/hash/indifferent_access.rb +24 -0
- data/lib/active_support/core_ext/hash/keys.rb +143 -0
- data/lib/active_support/core_ext/hash/reverse_merge.rb +25 -0
- data/lib/active_support/core_ext/hash/slice.rb +26 -0
- data/lib/active_support/core_ext/hash/transform_values.rb +5 -0
- data/lib/active_support/core_ext/integer.rb +5 -0
- data/lib/active_support/core_ext/integer/inflections.rb +31 -0
- data/lib/active_support/core_ext/integer/multiple.rb +12 -0
- data/lib/active_support/core_ext/integer/time.rb +22 -0
- data/lib/active_support/core_ext/kernel.rb +5 -0
- data/lib/active_support/core_ext/kernel/concern.rb +14 -0
- data/lib/active_support/core_ext/kernel/reporting.rb +45 -0
- data/lib/active_support/core_ext/kernel/singleton_class.rb +8 -0
- data/lib/active_support/core_ext/load_error.rb +9 -0
- data/lib/active_support/core_ext/marshal.rb +24 -0
- data/lib/active_support/core_ext/module.rb +13 -0
- data/lib/active_support/core_ext/module/aliasing.rb +31 -0
- data/lib/active_support/core_ext/module/anonymous.rb +30 -0
- data/lib/active_support/core_ext/module/attr_internal.rb +38 -0
- data/lib/active_support/core_ext/module/attribute_accessors.rb +212 -0
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +144 -0
- data/lib/active_support/core_ext/module/concerning.rb +134 -0
- data/lib/active_support/core_ext/module/delegation.rb +313 -0
- data/lib/active_support/core_ext/module/deprecation.rb +25 -0
- data/lib/active_support/core_ext/module/introspection.rb +86 -0
- data/lib/active_support/core_ext/module/reachable.rb +6 -0
- data/lib/active_support/core_ext/module/redefine_method.rb +40 -0
- data/lib/active_support/core_ext/module/remove_method.rb +17 -0
- data/lib/active_support/core_ext/name_error.rb +38 -0
- data/lib/active_support/core_ext/numeric.rb +5 -0
- data/lib/active_support/core_ext/numeric/bytes.rb +66 -0
- data/lib/active_support/core_ext/numeric/conversions.rb +136 -0
- data/lib/active_support/core_ext/numeric/inquiry.rb +5 -0
- data/lib/active_support/core_ext/numeric/time.rb +66 -0
- data/lib/active_support/core_ext/object.rb +16 -0
- data/lib/active_support/core_ext/object/acts_like.rb +21 -0
- data/lib/active_support/core_ext/object/blank.rb +155 -0
- data/lib/active_support/core_ext/object/conversions.rb +6 -0
- data/lib/active_support/core_ext/object/deep_dup.rb +55 -0
- data/lib/active_support/core_ext/object/duplicable.rb +49 -0
- data/lib/active_support/core_ext/object/inclusion.rb +29 -0
- data/lib/active_support/core_ext/object/instance_variables.rb +30 -0
- data/lib/active_support/core_ext/object/json.rb +228 -0
- data/lib/active_support/core_ext/object/to_param.rb +3 -0
- data/lib/active_support/core_ext/object/to_query.rb +89 -0
- data/lib/active_support/core_ext/object/try.rb +156 -0
- data/lib/active_support/core_ext/object/with_options.rb +82 -0
- data/lib/active_support/core_ext/range.rb +7 -0
- data/lib/active_support/core_ext/range/compare_range.rb +70 -0
- data/lib/active_support/core_ext/range/conversions.rb +41 -0
- data/lib/active_support/core_ext/range/each.rb +25 -0
- data/lib/active_support/core_ext/range/include_range.rb +9 -0
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +23 -0
- data/lib/active_support/core_ext/range/overlaps.rb +10 -0
- data/lib/active_support/core_ext/regexp.rb +7 -0
- data/lib/active_support/core_ext/securerandom.rb +45 -0
- data/lib/active_support/core_ext/string.rb +15 -0
- data/lib/active_support/core_ext/string/access.rb +114 -0
- data/lib/active_support/core_ext/string/behavior.rb +8 -0
- data/lib/active_support/core_ext/string/conversions.rb +59 -0
- data/lib/active_support/core_ext/string/exclude.rb +13 -0
- data/lib/active_support/core_ext/string/filters.rb +145 -0
- data/lib/active_support/core_ext/string/indent.rb +45 -0
- data/lib/active_support/core_ext/string/inflections.rb +259 -0
- data/lib/active_support/core_ext/string/inquiry.rb +15 -0
- data/lib/active_support/core_ext/string/multibyte.rb +58 -0
- data/lib/active_support/core_ext/string/output_safety.rb +314 -0
- data/lib/active_support/core_ext/string/starts_ends_with.rb +6 -0
- data/lib/active_support/core_ext/string/strip.rb +27 -0
- data/lib/active_support/core_ext/string/zones.rb +16 -0
- data/lib/active_support/core_ext/time.rb +7 -0
- data/lib/active_support/core_ext/time/acts_like.rb +10 -0
- data/lib/active_support/core_ext/time/calculations.rb +344 -0
- data/lib/active_support/core_ext/time/compatibility.rb +16 -0
- data/lib/active_support/core_ext/time/conversions.rb +72 -0
- data/lib/active_support/core_ext/time/zones.rb +113 -0
- data/lib/active_support/core_ext/uri.rb +25 -0
- data/lib/active_support/current_attributes.rb +203 -0
- data/lib/active_support/dependencies.rb +806 -0
- data/lib/active_support/dependencies/autoload.rb +79 -0
- data/lib/active_support/dependencies/interlock.rb +57 -0
- data/lib/active_support/dependencies/zeitwerk_integration.rb +110 -0
- data/lib/active_support/deprecation.rb +46 -0
- data/lib/active_support/deprecation/behaviors.rb +109 -0
- data/lib/active_support/deprecation/constant_accessor.rb +52 -0
- data/lib/active_support/deprecation/instance_delegator.rb +39 -0
- data/lib/active_support/deprecation/method_wrappers.rb +78 -0
- data/lib/active_support/deprecation/proxy_wrappers.rb +173 -0
- data/lib/active_support/deprecation/reporting.rb +114 -0
- data/lib/active_support/descendants_tracker.rb +109 -0
- data/lib/active_support/digest.rb +20 -0
- data/lib/active_support/duration.rb +433 -0
- data/lib/active_support/duration/iso8601_parser.rb +124 -0
- data/lib/active_support/duration/iso8601_serializer.rb +54 -0
- data/lib/active_support/encrypted_configuration.rb +45 -0
- data/lib/active_support/encrypted_file.rb +100 -0
- data/lib/active_support/evented_file_update_checker.rb +235 -0
- data/lib/active_support/execution_wrapper.rb +129 -0
- data/lib/active_support/executor.rb +8 -0
- data/lib/active_support/file_update_checker.rb +163 -0
- data/lib/active_support/gem_version.rb +17 -0
- data/lib/active_support/gzip.rb +38 -0
- data/lib/active_support/hash_with_indifferent_access.rb +399 -0
- data/lib/active_support/i18n.rb +16 -0
- data/lib/active_support/i18n_railtie.rb +126 -0
- data/lib/active_support/inflections.rb +72 -0
- data/lib/active_support/inflector.rb +9 -0
- data/lib/active_support/inflector/inflections.rb +257 -0
- data/lib/active_support/inflector/methods.rb +398 -0
- data/lib/active_support/inflector/transliterate.rb +147 -0
- data/lib/active_support/json.rb +4 -0
- data/lib/active_support/json/decoding.rb +76 -0
- data/lib/active_support/json/encoding.rb +134 -0
- data/lib/active_support/key_generator.rb +41 -0
- data/lib/active_support/lazy_load_hooks.rb +82 -0
- data/lib/active_support/locale/en.rb +31 -0
- data/lib/active_support/locale/en.yml +135 -0
- data/lib/active_support/log_subscriber.rb +135 -0
- data/lib/active_support/log_subscriber/test_helper.rb +106 -0
- data/lib/active_support/logger.rb +93 -0
- data/lib/active_support/logger_silence.rb +45 -0
- data/lib/active_support/logger_thread_safe_level.rb +56 -0
- data/lib/active_support/message_encryptor.rb +227 -0
- data/lib/active_support/message_verifier.rb +205 -0
- data/lib/active_support/messages/metadata.rb +71 -0
- data/lib/active_support/messages/rotation_configuration.rb +22 -0
- data/lib/active_support/messages/rotator.rb +56 -0
- data/lib/active_support/multibyte.rb +23 -0
- data/lib/active_support/multibyte/chars.rb +216 -0
- data/lib/active_support/multibyte/unicode.rb +157 -0
- data/lib/active_support/notifications.rb +253 -0
- data/lib/active_support/notifications/fanout.rb +244 -0
- data/lib/active_support/notifications/instrumenter.rb +164 -0
- data/lib/active_support/number_helper.rb +378 -0
- data/lib/active_support/number_helper/number_converter.rb +184 -0
- data/lib/active_support/number_helper/number_to_currency_converter.rb +46 -0
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +31 -0
- data/lib/active_support/number_helper/number_to_human_converter.rb +70 -0
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +61 -0
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +16 -0
- data/lib/active_support/number_helper/number_to_phone_converter.rb +60 -0
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +56 -0
- data/lib/active_support/number_helper/rounding_helper.rb +66 -0
- data/lib/active_support/option_merger.rb +27 -0
- data/lib/active_support/ordered_hash.rb +50 -0
- data/lib/active_support/ordered_options.rb +85 -0
- data/lib/active_support/parameter_filter.rb +129 -0
- data/lib/active_support/per_thread_registry.rb +60 -0
- data/lib/active_support/proxy_object.rb +15 -0
- data/lib/active_support/rails.rb +29 -0
- data/lib/active_support/railtie.rb +80 -0
- data/lib/active_support/reloader.rb +130 -0
- data/lib/active_support/rescuable.rb +174 -0
- data/lib/active_support/security_utils.rb +31 -0
- data/lib/active_support/string_inquirer.rb +34 -0
- data/lib/active_support/subscriber.rb +169 -0
- data/lib/active_support/tagged_logging.rb +88 -0
- data/lib/active_support/test_case.rb +163 -0
- data/lib/active_support/testing/assertions.rb +228 -0
- data/lib/active_support/testing/autorun.rb +7 -0
- data/lib/active_support/testing/constant_lookup.rb +51 -0
- data/lib/active_support/testing/declarative.rb +28 -0
- data/lib/active_support/testing/deprecation.rb +38 -0
- data/lib/active_support/testing/file_fixtures.rb +38 -0
- data/lib/active_support/testing/isolation.rb +110 -0
- data/lib/active_support/testing/method_call_assertions.rb +70 -0
- data/lib/active_support/testing/parallelization.rb +128 -0
- data/lib/active_support/testing/setup_and_teardown.rb +55 -0
- data/lib/active_support/testing/stream.rb +44 -0
- data/lib/active_support/testing/tagged_logging.rb +27 -0
- data/lib/active_support/testing/time_helpers.rb +200 -0
- data/lib/active_support/time.rb +20 -0
- data/lib/active_support/time_with_zone.rb +561 -0
- data/lib/active_support/values/time_zone.rb +570 -0
- data/lib/active_support/version.rb +10 -0
- data/lib/active_support/xml_mini.rb +202 -0
- data/lib/active_support/xml_mini/jdom.rb +183 -0
- data/lib/active_support/xml_mini/libxml.rb +80 -0
- data/lib/active_support/xml_mini/libxmlsax.rb +83 -0
- data/lib/active_support/xml_mini/nokogiri.rb +83 -0
- data/lib/active_support/xml_mini/nokogirisax.rb +86 -0
- data/lib/active_support/xml_mini/rexml.rb +130 -0
- metadata +385 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 20a0c971abcca4b9dabec6e28ef72c919a6ffaed5e35b29e4c3e2f359e99341b
|
4
|
+
data.tar.gz: e42089cf6ad412ef2fcf772afd6a8e010944b57fde1833c9d495dfb9c5eb3da5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8ff0c3e5feb9bb0dfcf5e0c95b4fb5bb8c6a30d2e276101c8ec949db9ad0895c397dc33cc1a99ec2636b45b3169a495eb8c852440956d8500d95399548b70948
|
7
|
+
data.tar.gz: fdf6945ee23e487a9b0403fcac9a7b51551900a6338a4caeb34970656033fd1e62c00eda5d463fb6fc3d0ad880470c7544f2a2108bcc5809520a8436d1bdf360
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,572 @@
|
|
1
|
+
## Rails 6.0.0 (August 16, 2019) ##
|
2
|
+
|
3
|
+
* Let `require_dependency` in `zeitwerk` mode look the autoload paths up for
|
4
|
+
better backwards compatibility.
|
5
|
+
|
6
|
+
*Xavier Noria*
|
7
|
+
|
8
|
+
* Let `require_dependency` in `zeitwerk` mode support arguments that respond
|
9
|
+
to `to_path` for better backwards compatibility.
|
10
|
+
|
11
|
+
*Xavier Noria*
|
12
|
+
|
13
|
+
* Make ActiveSupport::Logger Fiber-safe. Fixes #36752.
|
14
|
+
|
15
|
+
Use `Fiber.current.__id__` in `ActiveSupport::Logger#local_level=` in order
|
16
|
+
to make log level local to Ruby Fibers in addition to Threads.
|
17
|
+
|
18
|
+
Example:
|
19
|
+
|
20
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
21
|
+
logger.level = 1
|
22
|
+
p "Main is debug? #{logger.debug?}"
|
23
|
+
|
24
|
+
Fiber.new {
|
25
|
+
logger.local_level = 0
|
26
|
+
p "Thread is debug? #{logger.debug?}"
|
27
|
+
}.resume
|
28
|
+
|
29
|
+
p "Main is debug? #{logger.debug?}"
|
30
|
+
|
31
|
+
Before:
|
32
|
+
|
33
|
+
Main is debug? false
|
34
|
+
Thread is debug? true
|
35
|
+
Main is debug? true
|
36
|
+
|
37
|
+
After:
|
38
|
+
|
39
|
+
Main is debug? false
|
40
|
+
Thread is debug? true
|
41
|
+
Main is debug? false
|
42
|
+
|
43
|
+
*Alexander Varnin*
|
44
|
+
|
45
|
+
* Do not delegate missing `marshal_dump` and `_dump` methods via the
|
46
|
+
`delegate_missing_to` extension. This avoids unintentionally adding instance
|
47
|
+
variables when calling `Marshal.dump(object)`, should the delegation target of
|
48
|
+
`object` be a method which would otherwise add them. Fixes #36522.
|
49
|
+
|
50
|
+
*Aaron Lipman*
|
51
|
+
|
52
|
+
## Rails 6.0.0.rc2 (July 22, 2019) ##
|
53
|
+
|
54
|
+
* `truncate` would return the original string if it was too short to be truncated
|
55
|
+
and a frozen string if it were long enough to be truncated. Now truncate will
|
56
|
+
consistently return an unfrozen string regardless. This behavior is consistent
|
57
|
+
with `gsub` and `strip`.
|
58
|
+
|
59
|
+
Before:
|
60
|
+
|
61
|
+
'foobar'.truncate(5).frozen?
|
62
|
+
# => true
|
63
|
+
'foobar'.truncate(6).frozen?
|
64
|
+
# => false
|
65
|
+
|
66
|
+
After:
|
67
|
+
|
68
|
+
'foobar'.truncate(5).frozen?
|
69
|
+
# => false
|
70
|
+
'foobar'.truncate(6).frozen?
|
71
|
+
# => false
|
72
|
+
|
73
|
+
*Jordan Thomas*
|
74
|
+
|
75
|
+
|
76
|
+
## Rails 6.0.0.rc1 (April 24, 2019) ##
|
77
|
+
|
78
|
+
* Introduce `ActiveSupport::ActionableError`.
|
79
|
+
|
80
|
+
Actionable errors let's you dispatch actions from Rails' error pages. This
|
81
|
+
can help you save time if you have a clear action for the resolution of
|
82
|
+
common development errors.
|
83
|
+
|
84
|
+
The de-facto example are pending migrations. Every time pending migrations
|
85
|
+
are found, a middleware raises an error. With actionable errors, you can
|
86
|
+
run the migrations right from the error page. Other examples include Rails
|
87
|
+
plugins that need to run a rake task to setup themselves. They can now
|
88
|
+
raise actionable errors to run the setup straight from the error pages.
|
89
|
+
|
90
|
+
Here is how to define an actionable error:
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
class PendingMigrationError < MigrationError #:nodoc:
|
94
|
+
include ActiveSupport::ActionableError
|
95
|
+
|
96
|
+
action "Run pending migrations" do
|
97
|
+
ActiveRecord::Tasks::DatabaseTasks.migrate
|
98
|
+
end
|
99
|
+
end
|
100
|
+
```
|
101
|
+
|
102
|
+
To make an error actionable, include the `ActiveSupport::ActionableError`
|
103
|
+
module and invoke the `action` class macro to define the action. An action
|
104
|
+
needs a name and a procedure to execute. The name is shown as the name of a
|
105
|
+
button on the error pages. Once clicked, it will invoke the given
|
106
|
+
procedure.
|
107
|
+
|
108
|
+
*Vipul A M*, *Yao Jie*, *Genadi Samokovarov*
|
109
|
+
|
110
|
+
* Preserve `html_safe?` status on `ActiveSupport::SafeBuffer#*`.
|
111
|
+
|
112
|
+
Before:
|
113
|
+
|
114
|
+
("<br />".html_safe * 2).html_safe? #=> nil
|
115
|
+
|
116
|
+
After:
|
117
|
+
|
118
|
+
("<br />".html_safe * 2).html_safe? #=> true
|
119
|
+
|
120
|
+
*Ryo Nakamura*
|
121
|
+
|
122
|
+
* Calling test methods with `with_info_handler` method to allow minitest-hooks
|
123
|
+
plugin to work.
|
124
|
+
|
125
|
+
*Mauri Mustonen*
|
126
|
+
|
127
|
+
* The Zeitwerk compatibility interface for `ActiveSupport::Dependencies` no
|
128
|
+
longer implements `autoloaded_constants` or `autoloaded?` (undocumented,
|
129
|
+
anyway). Experience shows introspection does not have many use cases, and
|
130
|
+
troubleshooting is done by logging. With this design trade-off we are able
|
131
|
+
to use even less memory in all environments.
|
132
|
+
|
133
|
+
*Xavier Noria*
|
134
|
+
|
135
|
+
* Depends on Zeitwerk 2, which stores less metadata if reloading is disabled
|
136
|
+
and hence uses less memory when `config.cache_classes` is `true`, a standard
|
137
|
+
setup in production.
|
138
|
+
|
139
|
+
*Xavier Noria*
|
140
|
+
|
141
|
+
* In `:zeitwerk` mode, eager load directories in engines and applications only
|
142
|
+
if present in their respective `config.eager_load_paths`.
|
143
|
+
|
144
|
+
A common use case for this is adding `lib` to `config.autoload_paths`, but
|
145
|
+
not to `config.eager_load_paths`. In that configuration, for example, files
|
146
|
+
in the `lib` directory should not be eager loaded.
|
147
|
+
|
148
|
+
*Xavier Noria*
|
149
|
+
|
150
|
+
* Fix bug in Range comparisons when comparing to an excluded-end Range
|
151
|
+
|
152
|
+
Before:
|
153
|
+
|
154
|
+
(1..10).cover?(1...11) # => false
|
155
|
+
|
156
|
+
After:
|
157
|
+
|
158
|
+
(1..10).cover?(1...11) # => true
|
159
|
+
|
160
|
+
With the same change for `Range#include?` and `Range#===`.
|
161
|
+
|
162
|
+
*Owen Stephens*
|
163
|
+
|
164
|
+
* Use weak references in descendants tracker to allow anonymous subclasses to
|
165
|
+
be garbage collected.
|
166
|
+
|
167
|
+
*Edgars Beigarts*
|
168
|
+
|
169
|
+
* Update `ActiveSupport::Notifications::Instrumenter#instrument` to make
|
170
|
+
passing a block optional. This will let users use
|
171
|
+
`ActiveSupport::Notifications` messaging features outside of
|
172
|
+
instrumentation.
|
173
|
+
|
174
|
+
*Ali Ibrahim*
|
175
|
+
|
176
|
+
* Fix `Time#advance` to work with dates before 1001-03-07
|
177
|
+
|
178
|
+
Before:
|
179
|
+
|
180
|
+
Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-05 00:00:00 UTC
|
181
|
+
|
182
|
+
After
|
183
|
+
|
184
|
+
Time.utc(1001, 3, 6).advance(years: -1) # => 1000-03-06 00:00:00 UTC
|
185
|
+
|
186
|
+
Note that this doesn't affect `DateTime#advance` as that doesn't use a proleptic calendar.
|
187
|
+
|
188
|
+
*Andrew White*
|
189
|
+
|
190
|
+
* 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.
|
191
|
+
|
192
|
+
*Xavier Noria*
|
193
|
+
|
194
|
+
* Add support for supplying `locale` to `transliterate` and `parameterize`.
|
195
|
+
|
196
|
+
I18n.backend.store_translations(:de, i18n: { transliterate: { rule: { "ü" => "ue" } } })
|
197
|
+
|
198
|
+
ActiveSupport::Inflector.transliterate("ü", locale: :de) # => "ue"
|
199
|
+
"Fünf autos".parameterize(locale: :de) # => "fuenf-autos"
|
200
|
+
ActiveSupport::Inflector.parameterize("Fünf autos", locale: :de) # => "fuenf-autos"
|
201
|
+
|
202
|
+
*Kaan Ozkan*, *Sharang Dashputre*
|
203
|
+
|
204
|
+
* Allow `Array#excluding` and `Enumerable#excluding` to deal with a passed array gracefully.
|
205
|
+
|
206
|
+
[ 1, 2, 3, 4, 5 ].excluding([4, 5]) # => [ 1, 2, 3 ]
|
207
|
+
|
208
|
+
*DHH*
|
209
|
+
|
210
|
+
* Renamed `Array#without` and `Enumerable#without` to `Array#excluding` and `Enumerable#excluding`, to create parity with
|
211
|
+
`Array#including` and `Enumerable#including`. Retained the old names as aliases.
|
212
|
+
|
213
|
+
*DHH*
|
214
|
+
|
215
|
+
* Added `Array#including` and `Enumerable#including` to conveniently enlarge a collection with more members using a method rather than an operator:
|
216
|
+
|
217
|
+
[ 1, 2, 3 ].including(4, 5) # => [ 1, 2, 3, 4, 5 ]
|
218
|
+
post.authors.including(Current.person) # => All the authors plus the current person!
|
219
|
+
|
220
|
+
*DHH*
|
221
|
+
|
222
|
+
|
223
|
+
## Rails 6.0.0.beta3 (March 11, 2019) ##
|
224
|
+
|
225
|
+
* No changes.
|
226
|
+
|
227
|
+
|
228
|
+
## Rails 6.0.0.beta2 (February 25, 2019) ##
|
229
|
+
|
230
|
+
* New autoloading based on [Zeitwerk](https://github.com/fxn/zeitwerk).
|
231
|
+
|
232
|
+
*Xavier Noria*
|
233
|
+
|
234
|
+
* Revise `ActiveSupport::Notifications.unsubscribe` to correctly handle Regex or other multiple-pattern subscribers.
|
235
|
+
|
236
|
+
*Zach Kemp*
|
237
|
+
|
238
|
+
* Add `before_reset` callback to `CurrentAttributes` and define `after_reset` as an alias of `resets` for symmetry.
|
239
|
+
|
240
|
+
*Rosa Gutierrez*
|
241
|
+
|
242
|
+
* Remove the `` Kernel#` `` override that suppresses ENOENT and accidentally returns nil on Unix systems.
|
243
|
+
|
244
|
+
*Akinori Musha*
|
245
|
+
|
246
|
+
* Add `ActiveSupport::HashWithIndifferentAccess#assoc`.
|
247
|
+
|
248
|
+
`assoc` can now be called with either a string or a symbol.
|
249
|
+
|
250
|
+
*Stefan Schüßler*
|
251
|
+
|
252
|
+
* Add `Hash#deep_transform_values`, and `Hash#deep_transform_values!`.
|
253
|
+
|
254
|
+
*Guillermo Iguaran*
|
255
|
+
|
256
|
+
|
257
|
+
## Rails 6.0.0.beta1 (January 18, 2019) ##
|
258
|
+
|
259
|
+
* Remove deprecated `Module#reachable?` method.
|
260
|
+
|
261
|
+
*Rafael Mendonça França*
|
262
|
+
|
263
|
+
* Remove deprecated `#acronym_regex` method from `Inflections`.
|
264
|
+
|
265
|
+
*Rafael Mendonça França*
|
266
|
+
|
267
|
+
* Fix `String#safe_constantize` throwing a `LoadError` for incorrectly cased constant references.
|
268
|
+
|
269
|
+
*Keenan Brock*
|
270
|
+
|
271
|
+
* Preserve key order passed to `ActiveSupport::CacheStore#fetch_multi`.
|
272
|
+
|
273
|
+
`fetch_multi(*names)` now returns its results in the same order as the `*names` requested, rather than returning cache hits followed by cache misses.
|
274
|
+
|
275
|
+
*Gannon McGibbon*
|
276
|
+
|
277
|
+
* If the same block is `included` multiple times for a Concern, an exception is no longer raised.
|
278
|
+
|
279
|
+
*Mark J. Titorenko*, *Vlad Bokov*
|
280
|
+
|
281
|
+
* Fix bug where `#to_options` for `ActiveSupport::HashWithIndifferentAccess`
|
282
|
+
would not act as alias for `#symbolize_keys`.
|
283
|
+
|
284
|
+
*Nick Weiland*
|
285
|
+
|
286
|
+
* Improve the logic that detects non-autoloaded constants.
|
287
|
+
|
288
|
+
*Jan Habermann*, *Xavier Noria*
|
289
|
+
|
290
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#pack_graphemes(array)` and `ActiveSuppport::Multibyte::Unicode#unpack_graphemes(string)`
|
291
|
+
in favor of `array.flatten.pack("U*")` and `string.scan(/\X/).map(&:codepoints)`, respectively.
|
292
|
+
|
293
|
+
*Francesco Rodríguez*
|
294
|
+
|
295
|
+
* Deprecate `ActiveSupport::Multibyte::Chars.consumes?` in favor of `String#is_utf8?`.
|
296
|
+
|
297
|
+
*Francesco Rodríguez*
|
298
|
+
|
299
|
+
* Fix duration being rounded to a full second.
|
300
|
+
```
|
301
|
+
time = DateTime.parse("2018-1-1")
|
302
|
+
time += 0.51.seconds
|
303
|
+
```
|
304
|
+
Will now correctly add 0.51 second and not 1 full second.
|
305
|
+
|
306
|
+
*Edouard Chin*
|
307
|
+
|
308
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#normalize` and `ActiveSuppport::Multibyte::Chars#normalize`
|
309
|
+
in favor of `String#unicode_normalize`
|
310
|
+
|
311
|
+
*Francesco Rodríguez*
|
312
|
+
|
313
|
+
* Deprecate `ActiveSupport::Multibyte::Unicode#downcase/upcase/swapcase` in favor of
|
314
|
+
`String#downcase/upcase/swapcase`.
|
315
|
+
|
316
|
+
*Francesco Rodríguez*
|
317
|
+
|
318
|
+
* Add `ActiveSupport::ParameterFilter`.
|
319
|
+
|
320
|
+
*Yoshiyuki Kinjo*
|
321
|
+
|
322
|
+
* Rename `Module#parent`, `Module#parents`, and `Module#parent_name` to
|
323
|
+
`module_parent`, `module_parents`, and `module_parent_name`.
|
324
|
+
|
325
|
+
*Gannon McGibbon*
|
326
|
+
|
327
|
+
* Deprecate the use of `LoggerSilence` in favor of `ActiveSupport::LoggerSilence`
|
328
|
+
|
329
|
+
*Edouard Chin*
|
330
|
+
|
331
|
+
* Deprecate using negative limits in `String#first` and `String#last`.
|
332
|
+
|
333
|
+
*Gannon McGibbon*, *Eric Turner*
|
334
|
+
|
335
|
+
* Fix bug where `#without` for `ActiveSupport::HashWithIndifferentAccess` would fail
|
336
|
+
with symbol arguments
|
337
|
+
|
338
|
+
*Abraham Chan*
|
339
|
+
|
340
|
+
* Treat `#delete_prefix`, `#delete_suffix` and `#unicode_normalize` results as non-`html_safe`.
|
341
|
+
Ensure safety of arguments for `#insert`, `#[]=` and `#replace` calls on `html_safe` Strings.
|
342
|
+
|
343
|
+
*Janosch Müller*
|
344
|
+
|
345
|
+
* Changed `ActiveSupport::TaggedLogging.new` to return a new logger instance instead
|
346
|
+
of mutating the one received as parameter.
|
347
|
+
|
348
|
+
*Thierry Joyal*
|
349
|
+
|
350
|
+
* Define `unfreeze_time` as an alias of `travel_back` in `ActiveSupport::Testing::TimeHelpers`.
|
351
|
+
|
352
|
+
The alias is provided for symmetry with `freeze_time`.
|
353
|
+
|
354
|
+
*Ryan Davidson*
|
355
|
+
|
356
|
+
* Add support for tracing constant autoloads. Just throw
|
357
|
+
|
358
|
+
ActiveSupport::Dependencies.logger = Rails.logger
|
359
|
+
ActiveSupport::Dependencies.verbose = true
|
360
|
+
|
361
|
+
in an initializer.
|
362
|
+
|
363
|
+
*Xavier Noria*
|
364
|
+
|
365
|
+
* Maintain `html_safe?` on html_safe strings when sliced.
|
366
|
+
|
367
|
+
string = "<div>test</div>".html_safe
|
368
|
+
string[-1..1].html_safe? # => true
|
369
|
+
|
370
|
+
*Elom Gomez*, *Yumin Wong*
|
371
|
+
|
372
|
+
* Add `Array#extract!`.
|
373
|
+
|
374
|
+
The method removes and returns the elements for which the block returns a true value.
|
375
|
+
If no block is given, an Enumerator is returned instead.
|
376
|
+
|
377
|
+
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
378
|
+
odd_numbers = numbers.extract! { |number| number.odd? } # => [1, 3, 5, 7, 9]
|
379
|
+
numbers # => [0, 2, 4, 6, 8]
|
380
|
+
|
381
|
+
*bogdanvlviv*
|
382
|
+
|
383
|
+
* Support not to cache `nil` for `ActiveSupport::Cache#fetch`.
|
384
|
+
|
385
|
+
cache.fetch('bar', skip_nil: true) { nil }
|
386
|
+
cache.exist?('bar') # => false
|
387
|
+
|
388
|
+
*Martin Hong*
|
389
|
+
|
390
|
+
* Add "event object" support to the notification system.
|
391
|
+
Before this change, end users were forced to create hand made artisanal
|
392
|
+
event objects on their own, like this:
|
393
|
+
|
394
|
+
ActiveSupport::Notifications.subscribe('wait') do |*args|
|
395
|
+
@event = ActiveSupport::Notifications::Event.new(*args)
|
396
|
+
end
|
397
|
+
|
398
|
+
ActiveSupport::Notifications.instrument('wait') do
|
399
|
+
sleep 1
|
400
|
+
end
|
401
|
+
|
402
|
+
@event.duration # => 1000.138
|
403
|
+
|
404
|
+
After this change, if the block passed to `subscribe` only takes one
|
405
|
+
parameter, the framework will yield an event object to the block. Now
|
406
|
+
end users are no longer required to make their own:
|
407
|
+
|
408
|
+
ActiveSupport::Notifications.subscribe('wait') do |event|
|
409
|
+
@event = event
|
410
|
+
end
|
411
|
+
|
412
|
+
ActiveSupport::Notifications.instrument('wait') do
|
413
|
+
sleep 1
|
414
|
+
end
|
415
|
+
|
416
|
+
p @event.allocations # => 7
|
417
|
+
p @event.cpu_time # => 0.256
|
418
|
+
p @event.idle_time # => 1003.2399
|
419
|
+
|
420
|
+
Now you can enjoy event objects without making them yourself. Neat!
|
421
|
+
|
422
|
+
*Aaron "t.lo" Patterson*
|
423
|
+
|
424
|
+
* Add cpu_time, idle_time, and allocations to Event.
|
425
|
+
|
426
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
427
|
+
|
428
|
+
* RedisCacheStore: support key expiry in increment/decrement.
|
429
|
+
|
430
|
+
Pass `:expires_in` to `#increment` and `#decrement` to set a Redis EXPIRE on the key.
|
431
|
+
|
432
|
+
If the key is already set to expire, RedisCacheStore won't extend its expiry.
|
433
|
+
|
434
|
+
Rails.cache.increment("some_key", 1, expires_in: 2.minutes)
|
435
|
+
|
436
|
+
*Jason Lee*
|
437
|
+
|
438
|
+
* Allow `Range#===` and `Range#cover?` on Range.
|
439
|
+
|
440
|
+
`Range#cover?` can now accept a range argument like `Range#include?` and
|
441
|
+
`Range#===`. `Range#===` works correctly on Ruby 2.6. `Range#include?` is moved
|
442
|
+
into a new file, with these two methods.
|
443
|
+
|
444
|
+
*Requiring active_support/core_ext/range/include_range is now deprecated.*
|
445
|
+
*Use `require "active_support/core_ext/range/compare_range"` instead.*
|
446
|
+
|
447
|
+
*utilum*
|
448
|
+
|
449
|
+
* Add `index_with` to Enumerable.
|
450
|
+
|
451
|
+
Allows creating a hash from an enumerable with the value from a passed block
|
452
|
+
or a default argument.
|
453
|
+
|
454
|
+
%i( title body ).index_with { |attr| post.public_send(attr) }
|
455
|
+
# => { title: "hey", body: "what's up?" }
|
456
|
+
|
457
|
+
%i( title body ).index_with(nil)
|
458
|
+
# => { title: nil, body: nil }
|
459
|
+
|
460
|
+
Closely linked with `index_by`, which creates a hash where the keys are extracted from a block.
|
461
|
+
|
462
|
+
*Kasper Timm Hansen*
|
463
|
+
|
464
|
+
* Fix bug where `ActiveSupport::TimeZone.all` would fail when tzinfo data for
|
465
|
+
any timezone defined in `ActiveSupport::TimeZone::MAPPING` is missing.
|
466
|
+
|
467
|
+
*Dominik Sander*
|
468
|
+
|
469
|
+
* Redis cache store: `delete_matched` no longer blocks the Redis server.
|
470
|
+
(Switches from evaled Lua to a batched SCAN + DEL loop.)
|
471
|
+
|
472
|
+
*Gleb Mazovetskiy*
|
473
|
+
|
474
|
+
* Fix bug where `ActiveSupport::Cache` will massively inflate the storage
|
475
|
+
size when compression is enabled (which is true by default). This patch
|
476
|
+
does not attempt to repair existing data: please manually flush the cache
|
477
|
+
to clear out the problematic entries.
|
478
|
+
|
479
|
+
*Godfrey Chan*
|
480
|
+
|
481
|
+
* Fix bug where `URI.unescape` would fail with mixed Unicode/escaped character input:
|
482
|
+
|
483
|
+
URI.unescape("\xe3\x83\x90") # => "バ"
|
484
|
+
URI.unescape("%E3%83%90") # => "バ"
|
485
|
+
URI.unescape("\xe3\x83\x90%E3%83%90") # => Encoding::CompatibilityError
|
486
|
+
|
487
|
+
*Ashe Connor*, *Aaron Patterson*
|
488
|
+
|
489
|
+
* Add `before?` and `after?` methods to `Date`, `DateTime`,
|
490
|
+
`Time`, and `TimeWithZone`.
|
491
|
+
|
492
|
+
*Nick Holden*
|
493
|
+
|
494
|
+
* `ActiveSupport::Inflector#ordinal` and `ActiveSupport::Inflector#ordinalize` now support
|
495
|
+
translations through I18n.
|
496
|
+
|
497
|
+
# locale/fr.rb
|
498
|
+
|
499
|
+
{
|
500
|
+
fr: {
|
501
|
+
number: {
|
502
|
+
nth: {
|
503
|
+
ordinals: lambda do |_key, number:, **_options|
|
504
|
+
if number.to_i.abs == 1
|
505
|
+
'er'
|
506
|
+
else
|
507
|
+
'e'
|
508
|
+
end
|
509
|
+
end,
|
510
|
+
|
511
|
+
ordinalized: lambda do |_key, number:, **_options|
|
512
|
+
"#{number}#{ActiveSupport::Inflector.ordinal(number)}"
|
513
|
+
end
|
514
|
+
}
|
515
|
+
}
|
516
|
+
}
|
517
|
+
}
|
518
|
+
|
519
|
+
|
520
|
+
*Christian Blais*
|
521
|
+
|
522
|
+
* Add `:private` option to ActiveSupport's `Module#delegate`
|
523
|
+
in order to delegate methods as private:
|
524
|
+
|
525
|
+
class User < ActiveRecord::Base
|
526
|
+
has_one :profile
|
527
|
+
delegate :date_of_birth, to: :profile, private: true
|
528
|
+
|
529
|
+
def age
|
530
|
+
Date.today.year - date_of_birth.year
|
531
|
+
end
|
532
|
+
end
|
533
|
+
|
534
|
+
# User.new.age # => 29
|
535
|
+
# User.new.date_of_birth
|
536
|
+
# => NoMethodError: private method `date_of_birth' called for #<User:0x00000008221340>
|
537
|
+
|
538
|
+
*Tomas Valent*
|
539
|
+
|
540
|
+
* `String#truncate_bytes` to truncate a string to a maximum bytesize without
|
541
|
+
breaking multibyte characters or grapheme clusters like 👩👩👦👦.
|
542
|
+
|
543
|
+
*Jeremy Daer*
|
544
|
+
|
545
|
+
* `String#strip_heredoc` preserves frozenness.
|
546
|
+
|
547
|
+
"foo".freeze.strip_heredoc.frozen? # => true
|
548
|
+
|
549
|
+
Fixes that frozen string literals would inadvertently become unfrozen:
|
550
|
+
|
551
|
+
# frozen_string_literal: true
|
552
|
+
|
553
|
+
foo = <<-MSG.strip_heredoc
|
554
|
+
la la la
|
555
|
+
MSG
|
556
|
+
|
557
|
+
foo.frozen? # => false !??
|
558
|
+
|
559
|
+
*Jeremy Daer*
|
560
|
+
|
561
|
+
* Rails 6 requires Ruby 2.5.0 or newer.
|
562
|
+
|
563
|
+
*Jeremy Daer*, *Kasper Timm Hansen*
|
564
|
+
|
565
|
+
* Adds parallel testing to Rails.
|
566
|
+
|
567
|
+
Parallelize your test suite with forked processes or threads.
|
568
|
+
|
569
|
+
*Eileen M. Uchitelle*, *Aaron Patterson*
|
570
|
+
|
571
|
+
|
572
|
+
Please check [5-2-stable](https://github.com/rails/rails/blob/5-2-stable/activesupport/CHANGELOG.md) for previous changes.
|