activesupport 6.1.2.1 → 6.1.7.3
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 +153 -1
- data/MIT-LICENSE +1 -1
- data/lib/active_support/cache/file_store.rb +1 -1
- data/lib/active_support/cache/mem_cache_store.rb +1 -1
- data/lib/active_support/cache.rb +7 -1
- data/lib/active_support/configuration_file.rb +6 -1
- data/lib/active_support/core_ext/digest/uuid.rb +1 -0
- data/lib/active_support/core_ext/string/output_safety.rb +32 -0
- data/lib/active_support/core_ext/time/calculations.rb +5 -8
- data/lib/active_support/core_ext/uri.rb +1 -1
- data/lib/active_support/current_attributes.rb +2 -0
- data/lib/active_support/dependencies/zeitwerk_integration.rb +4 -1
- data/lib/active_support/deprecation.rb +1 -1
- data/lib/active_support/digest.rb +2 -0
- data/lib/active_support/duration.rb +4 -3
- data/lib/active_support/execution_wrapper.rb +16 -13
- data/lib/active_support/fork_tracker.rb +2 -0
- data/lib/active_support/gem_version.rb +2 -2
- data/lib/active_support/hash_with_indifferent_access.rb +6 -1
- data/lib/active_support/inflector/methods.rb +1 -2
- data/lib/active_support/locale/en.yml +1 -1
- data/lib/active_support/multibyte/unicode.rb +2 -2
- data/lib/active_support/notifications.rb +1 -1
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +10 -6
- data/lib/active_support/number_helper/rounding_helper.rb +1 -1
- data/lib/active_support/parameter_filter.rb +1 -1
- data/lib/active_support/per_thread_registry.rb +1 -0
- data/lib/active_support/railtie.rb +1 -1
- data/lib/active_support/reloader.rb +1 -1
- data/lib/active_support/security_utils.rb +1 -1
- data/lib/active_support/tagged_logging.rb +1 -1
- data/lib/active_support/testing/assertions.rb +1 -1
- data/lib/active_support/time_with_zone.rb +1 -1
- data/lib/active_support/values/time_zone.rb +3 -1
- data/lib/active_support.rb +1 -1
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08925ee6844118b92f0574ccff73c19cb3cb114f9666a0f0a49d5c33a313fcf3'
|
4
|
+
data.tar.gz: e2e43e6cc370cfc52567071f0d53bc00e39767987530f64b5a32ec03016eceda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ec45336e7d88f27c3737279c6bad52cc313208205e937bdd3df72c269106ed6064be74e36fb925826856f8558aeb4e7bc3c9ff9076d11032f060ecd51d8083b
|
7
|
+
data.tar.gz: f356a689c99bccfe6aad84c76497a6e19e2ea2f415a91dd96c7095f962c3cc2cda87278364fd2b7d06450b4bbd503d9628772878afa311934ff6a771287eedca
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,155 @@
|
|
1
|
+
## Rails 6.1.7.3 (March 13, 2023) ##
|
2
|
+
|
3
|
+
* Implement SafeBuffer#bytesplice
|
4
|
+
|
5
|
+
[CVE-2023-28120]
|
6
|
+
|
7
|
+
|
8
|
+
## Rails 6.1.7.2 (January 24, 2023) ##
|
9
|
+
|
10
|
+
* No changes.
|
11
|
+
|
12
|
+
|
13
|
+
## Rails 6.1.7.1 (January 17, 2023) ##
|
14
|
+
|
15
|
+
* Avoid regex backtracking in Inflector.underscore
|
16
|
+
|
17
|
+
[CVE-2023-22796]
|
18
|
+
|
19
|
+
|
20
|
+
## Rails 6.1.7 (September 09, 2022) ##
|
21
|
+
|
22
|
+
* No changes.
|
23
|
+
|
24
|
+
|
25
|
+
## Rails 6.1.6.1 (July 12, 2022) ##
|
26
|
+
|
27
|
+
* No changes.
|
28
|
+
|
29
|
+
|
30
|
+
## Rails 6.1.6 (May 09, 2022) ##
|
31
|
+
|
32
|
+
* No changes.
|
33
|
+
|
34
|
+
|
35
|
+
## Rails 6.1.5.1 (April 26, 2022) ##
|
36
|
+
|
37
|
+
* Fix and add protections for XSS in `ActionView::Helpers` and `ERB::Util`.
|
38
|
+
|
39
|
+
Add the method `ERB::Util.xml_name_escape` to escape dangerous characters
|
40
|
+
in names of tags and names of attributes, following the specification of XML.
|
41
|
+
|
42
|
+
*Álvaro Martín Fraguas*
|
43
|
+
|
44
|
+
## Rails 6.1.5 (March 09, 2022) ##
|
45
|
+
|
46
|
+
* Fix `ActiveSupport::Duration.build` to support negative values.
|
47
|
+
|
48
|
+
The algorithm to collect the `parts` of the `ActiveSupport::Duration`
|
49
|
+
ignored the sign of the `value` and accumulated incorrect part values. This
|
50
|
+
impacted `ActiveSupport::Duration#sum` (which is dependent on `parts`) but
|
51
|
+
not `ActiveSupport::Duration#eql?` (which is dependent on `value`).
|
52
|
+
|
53
|
+
*Caleb Buxton*, *Braden Staudacher*
|
54
|
+
|
55
|
+
* `Time#change` and methods that call it (eg. `Time#advance`) will now
|
56
|
+
return a `Time` with the timezone argument provided, if the caller was
|
57
|
+
initialized with a timezone argument.
|
58
|
+
|
59
|
+
Fixes [#42467](https://github.com/rails/rails/issues/42467).
|
60
|
+
|
61
|
+
*Alex Ghiculescu*
|
62
|
+
|
63
|
+
* Clone to keep extended Logger methods for tagged logger.
|
64
|
+
|
65
|
+
*Orhan Toy*
|
66
|
+
|
67
|
+
* `assert_changes` works on including `ActiveSupport::Assertions` module.
|
68
|
+
|
69
|
+
*Pedro Medeiros*
|
70
|
+
|
71
|
+
|
72
|
+
## Rails 6.1.4.7 (March 08, 2022) ##
|
73
|
+
|
74
|
+
* No changes.
|
75
|
+
|
76
|
+
|
77
|
+
## Rails 6.1.4.6 (February 11, 2022) ##
|
78
|
+
|
79
|
+
* Fix Reloader method signature to work with the new Executor signature
|
80
|
+
|
81
|
+
|
82
|
+
## Rails 6.1.4.5 (February 11, 2022) ##
|
83
|
+
|
84
|
+
* No changes.
|
85
|
+
|
86
|
+
|
87
|
+
## Rails 6.1.4.4 (December 15, 2021) ##
|
88
|
+
|
89
|
+
* No changes.
|
90
|
+
|
91
|
+
|
92
|
+
## Rails 6.1.4.3 (December 14, 2021) ##
|
93
|
+
|
94
|
+
* No changes.
|
95
|
+
|
96
|
+
|
97
|
+
## Rails 6.1.4.2 (December 14, 2021) ##
|
98
|
+
|
99
|
+
* No changes.
|
100
|
+
|
101
|
+
|
102
|
+
## Rails 6.1.4.1 (August 19, 2021) ##
|
103
|
+
|
104
|
+
* No changes.
|
105
|
+
|
106
|
+
|
107
|
+
## Rails 6.1.4 (June 24, 2021) ##
|
108
|
+
|
109
|
+
* MemCacheStore: convert any underlying value (including `false`) to an `Entry`.
|
110
|
+
|
111
|
+
See [#42559](https://github.com/rails/rails/pull/42559).
|
112
|
+
|
113
|
+
*Alex Ghiculescu*
|
114
|
+
|
115
|
+
* Fix bug in `number_with_precision` when using large `BigDecimal` values.
|
116
|
+
|
117
|
+
Fixes #42302.
|
118
|
+
|
119
|
+
*Federico Aldunate*, *Zachary Scott*
|
120
|
+
|
121
|
+
* Check byte size instead of length on `secure_compare`.
|
122
|
+
|
123
|
+
*Tietew*
|
124
|
+
|
125
|
+
* Fix `Time.at` to not lose `:in` option.
|
126
|
+
|
127
|
+
*Ryuta Kamizono*
|
128
|
+
|
129
|
+
* Require a path for `config.cache_store = :file_store`.
|
130
|
+
|
131
|
+
*Alex Ghiculescu*
|
132
|
+
|
133
|
+
* Avoid having to store complex object in the default translation file.
|
134
|
+
|
135
|
+
*Rafael Mendonça França*
|
136
|
+
|
137
|
+
|
138
|
+
## Rails 6.1.3.2 (May 05, 2021) ##
|
139
|
+
|
140
|
+
* No changes.
|
141
|
+
|
142
|
+
|
143
|
+
## Rails 6.1.3.1 (March 26, 2021) ##
|
144
|
+
|
145
|
+
* No changes.
|
146
|
+
|
147
|
+
|
148
|
+
## Rails 6.1.3 (February 17, 2021) ##
|
149
|
+
|
150
|
+
* No changes.
|
151
|
+
|
152
|
+
|
1
153
|
## Rails 6.1.2.1 (February 10, 2021) ##
|
2
154
|
|
3
155
|
* No changes.
|
@@ -227,7 +379,7 @@
|
|
227
379
|
|
228
380
|
*Max Gurewitz*
|
229
381
|
|
230
|
-
* `URI.parser` is deprecated and will be removed in Rails
|
382
|
+
* `URI.parser` is deprecated and will be removed in Rails 7.0. Use
|
231
383
|
`URI::DEFAULT_PARSER` instead.
|
232
384
|
|
233
385
|
*Jean Boussier*
|
data/MIT-LICENSE
CHANGED
@@ -20,7 +20,7 @@ module ActiveSupport
|
|
20
20
|
FILEPATH_MAX_SIZE = 900 # max is 1024, plus some room
|
21
21
|
GITKEEP_FILES = [".gitkeep", ".keep"].freeze
|
22
22
|
|
23
|
-
def initialize(cache_path, options
|
23
|
+
def initialize(cache_path, **options)
|
24
24
|
super(options)
|
25
25
|
@cache_path = cache_path.to_s
|
26
26
|
end
|
@@ -198,7 +198,7 @@ module ActiveSupport
|
|
198
198
|
|
199
199
|
def deserialize_entry(payload)
|
200
200
|
entry = super
|
201
|
-
entry = Entry.new(entry, compress: false)
|
201
|
+
entry = Entry.new(entry, compress: false) unless entry.nil? || entry.is_a?(Entry)
|
202
202
|
entry
|
203
203
|
end
|
204
204
|
|
data/lib/active_support/cache.rb
CHANGED
@@ -58,7 +58,13 @@ module ActiveSupport
|
|
58
58
|
case store
|
59
59
|
when Symbol
|
60
60
|
options = parameters.extract_options!
|
61
|
-
|
61
|
+
# clean this up once Ruby 2.7 support is dropped
|
62
|
+
# see https://github.com/rails/rails/pull/41522#discussion_r581186602
|
63
|
+
if options.empty?
|
64
|
+
retrieve_store_class(store).new(*parameters)
|
65
|
+
else
|
66
|
+
retrieve_store_class(store).new(*parameters, **options)
|
67
|
+
end
|
62
68
|
when Array
|
63
69
|
lookup_store(*store)
|
64
70
|
when nil
|
@@ -19,7 +19,12 @@ module ActiveSupport
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def parse(context: nil, **options)
|
22
|
-
|
22
|
+
source = render(context)
|
23
|
+
if YAML.respond_to?(:unsafe_load)
|
24
|
+
YAML.unsafe_load(source, **options) || {}
|
25
|
+
else
|
26
|
+
YAML.load(source, **options) || {}
|
27
|
+
end
|
23
28
|
rescue Psych::SyntaxError => error
|
24
29
|
raise "YAML syntax error occurred while parsing #{@content_path}. " \
|
25
30
|
"Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \
|
@@ -11,6 +11,14 @@ class ERB
|
|
11
11
|
HTML_ESCAPE_ONCE_REGEXP = /["><']|&(?!([a-zA-Z]+|(#\d+)|(#[xX][\dA-Fa-f]+));)/
|
12
12
|
JSON_ESCAPE_REGEXP = /[\u2028\u2029&><]/u
|
13
13
|
|
14
|
+
# Following XML requirements: https://www.w3.org/TR/REC-xml/#NT-Name
|
15
|
+
TAG_NAME_START_REGEXP_SET = "@:A-Z_a-z\u{C0}-\u{D6}\u{D8}-\u{F6}\u{F8}-\u{2FF}\u{370}-\u{37D}\u{37F}-\u{1FFF}" \
|
16
|
+
"\u{200C}-\u{200D}\u{2070}-\u{218F}\u{2C00}-\u{2FEF}\u{3001}-\u{D7FF}\u{F900}-\u{FDCF}" \
|
17
|
+
"\u{FDF0}-\u{FFFD}\u{10000}-\u{EFFFF}"
|
18
|
+
TAG_NAME_START_REGEXP = /[^#{TAG_NAME_START_REGEXP_SET}]/
|
19
|
+
TAG_NAME_FOLLOWING_REGEXP = /[^#{TAG_NAME_START_REGEXP_SET}\-.0-9\u{B7}\u{0300}-\u{036F}\u{203F}-\u{2040}]/
|
20
|
+
TAG_NAME_REPLACEMENT_CHAR = "_"
|
21
|
+
|
14
22
|
# A utility method for escaping HTML tag characters.
|
15
23
|
# This method is also aliased as <tt>h</tt>.
|
16
24
|
#
|
@@ -115,6 +123,26 @@ class ERB
|
|
115
123
|
end
|
116
124
|
|
117
125
|
module_function :json_escape
|
126
|
+
|
127
|
+
# A utility method for escaping XML names of tags and names of attributes.
|
128
|
+
#
|
129
|
+
# xml_name_escape('1 < 2 & 3')
|
130
|
+
# # => "1___2___3"
|
131
|
+
#
|
132
|
+
# It follows the requirements of the specification: https://www.w3.org/TR/REC-xml/#NT-Name
|
133
|
+
def xml_name_escape(name)
|
134
|
+
name = name.to_s
|
135
|
+
return "" if name.blank?
|
136
|
+
|
137
|
+
starting_char = name[0].gsub(TAG_NAME_START_REGEXP, TAG_NAME_REPLACEMENT_CHAR)
|
138
|
+
|
139
|
+
return starting_char if name.size == 1
|
140
|
+
|
141
|
+
following_chars = name[1..-1].gsub(TAG_NAME_FOLLOWING_REGEXP, TAG_NAME_REPLACEMENT_CHAR)
|
142
|
+
|
143
|
+
starting_char + following_chars
|
144
|
+
end
|
145
|
+
module_function :xml_name_escape
|
118
146
|
end
|
119
147
|
end
|
120
148
|
|
@@ -188,6 +216,10 @@ module ActiveSupport #:nodoc:
|
|
188
216
|
end
|
189
217
|
alias << concat
|
190
218
|
|
219
|
+
def bytesplice(*args, value)
|
220
|
+
super(*args, implicit_html_escape_interpolated_argument(value))
|
221
|
+
end
|
222
|
+
|
191
223
|
def insert(index, value)
|
192
224
|
super(index, html_escape_interpolated_argument(value))
|
193
225
|
end
|
@@ -42,14 +42,8 @@ class Time
|
|
42
42
|
|
43
43
|
# Layers additional behavior on Time.at so that ActiveSupport::TimeWithZone and DateTime
|
44
44
|
# instances can be used when called with a single argument
|
45
|
-
def at_with_coercion(*args
|
46
|
-
if args.size != 1
|
47
|
-
if kwargs.empty?
|
48
|
-
return at_without_coercion(*args)
|
49
|
-
else
|
50
|
-
return at_without_coercion(*args, **kwargs)
|
51
|
-
end
|
52
|
-
end
|
45
|
+
def at_with_coercion(*args)
|
46
|
+
return at_without_coercion(*args) if args.size != 1
|
53
47
|
|
54
48
|
# Time.at can be called with a time or numerical value
|
55
49
|
time_or_number = args.first
|
@@ -62,6 +56,7 @@ class Time
|
|
62
56
|
at_without_coercion(time_or_number)
|
63
57
|
end
|
64
58
|
end
|
59
|
+
ruby2_keywords(:at_with_coercion) if respond_to?(:ruby2_keywords, true)
|
65
60
|
alias_method :at_without_coercion, :at
|
66
61
|
alias_method :at, :at_with_coercion
|
67
62
|
|
@@ -165,6 +160,8 @@ class Time
|
|
165
160
|
::Time.new(new_year, new_month, new_day, new_hour, new_min, new_sec, new_offset)
|
166
161
|
elsif utc?
|
167
162
|
::Time.utc(new_year, new_month, new_day, new_hour, new_min, new_sec)
|
163
|
+
elsif zone&.respond_to?(:utc_to_local)
|
164
|
+
::Time.new(new_year, new_month, new_day, new_hour, new_min, new_sec, zone)
|
168
165
|
elsif zone
|
169
166
|
::Time.local(new_year, new_month, new_day, new_hour, new_min, new_sec)
|
170
167
|
else
|
@@ -20,7 +20,7 @@ module URI
|
|
20
20
|
class << self
|
21
21
|
def parser
|
22
22
|
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
23
|
-
URI.parser is deprecated and will be removed in Rails
|
23
|
+
URI.parser is deprecated and will be removed in Rails 7.0.
|
24
24
|
Use `URI::DEFAULT_PARSER` instead.
|
25
25
|
MSG
|
26
26
|
URI::DEFAULT_PARSER
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require "active_support/callbacks"
|
4
4
|
require "active_support/core_ext/enumerable"
|
5
|
+
require "active_support/core_ext/module/delegation"
|
5
6
|
|
6
7
|
module ActiveSupport
|
7
8
|
# Abstract super class that provides a thread-isolated attributes singleton, which resets automatically
|
@@ -163,6 +164,7 @@ module ActiveSupport
|
|
163
164
|
|
164
165
|
send(name, *args, &block)
|
165
166
|
end
|
167
|
+
ruby2_keywords(:method_missing) if respond_to?(:ruby2_keywords, true)
|
166
168
|
end
|
167
169
|
|
168
170
|
attr_accessor :attributes
|
@@ -89,7 +89,10 @@ module ActiveSupport
|
|
89
89
|
end
|
90
90
|
|
91
91
|
Rails.autoloaders.main.enable_reloading if enable_reloading
|
92
|
-
|
92
|
+
|
93
|
+
# Order matters.
|
94
|
+
Rails.autoloaders.once.setup
|
95
|
+
Rails.autoloaders.main.setup
|
93
96
|
end
|
94
97
|
|
95
98
|
def autoload_once?(autoload_path)
|
@@ -38,7 +38,7 @@ module ActiveSupport
|
|
38
38
|
# and the second is a library name.
|
39
39
|
#
|
40
40
|
# ActiveSupport::Deprecation.new('2.0', 'MyLibrary')
|
41
|
-
def initialize(deprecation_horizon = "
|
41
|
+
def initialize(deprecation_horizon = "7.0", gem_name = "Rails")
|
42
42
|
self.gem_name = gem_name
|
43
43
|
self.deprecation_horizon = deprecation_horizon
|
44
44
|
# By default, warnings are not silenced and debugging is off.
|
@@ -186,17 +186,18 @@ module ActiveSupport
|
|
186
186
|
end
|
187
187
|
|
188
188
|
parts = {}
|
189
|
-
|
189
|
+
remainder_sign = value <=> 0
|
190
|
+
remainder = value.round(9).abs
|
190
191
|
|
191
192
|
PARTS.each do |part|
|
192
193
|
unless part == :seconds
|
193
194
|
part_in_seconds = PARTS_IN_SECONDS[part]
|
194
|
-
parts[part] = remainder.div(part_in_seconds)
|
195
|
+
parts[part] = remainder.div(part_in_seconds) * remainder_sign
|
195
196
|
remainder %= part_in_seconds
|
196
197
|
end
|
197
198
|
end unless value == 0
|
198
199
|
|
199
|
-
parts[:seconds] = remainder
|
200
|
+
parts[:seconds] = remainder * remainder_sign
|
200
201
|
|
201
202
|
new(value, parts)
|
202
203
|
end
|
@@ -63,18 +63,21 @@ module ActiveSupport
|
|
63
63
|
# after the work has been performed.
|
64
64
|
#
|
65
65
|
# Where possible, prefer +wrap+.
|
66
|
-
def self.run!
|
67
|
-
if
|
68
|
-
|
66
|
+
def self.run!(reset: false)
|
67
|
+
if reset
|
68
|
+
lost_instance = active.delete(Thread.current)
|
69
|
+
lost_instance&.complete!
|
69
70
|
else
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
71
|
+
return Null if active?
|
72
|
+
end
|
73
|
+
|
74
|
+
new.tap do |instance|
|
75
|
+
success = nil
|
76
|
+
begin
|
77
|
+
instance.run!
|
78
|
+
success = true
|
79
|
+
ensure
|
80
|
+
instance.complete! unless success
|
78
81
|
end
|
79
82
|
end
|
80
83
|
end
|
@@ -103,11 +106,11 @@ module ActiveSupport
|
|
103
106
|
self.active = Concurrent::Hash.new
|
104
107
|
|
105
108
|
def self.active? # :nodoc:
|
106
|
-
@active
|
109
|
+
@active.key?(Thread.current)
|
107
110
|
end
|
108
111
|
|
109
112
|
def run! # :nodoc:
|
110
|
-
self.class.active[Thread.current] =
|
113
|
+
self.class.active[Thread.current] = self
|
111
114
|
run_callbacks(:run)
|
112
115
|
end
|
113
116
|
|
@@ -16,6 +16,7 @@ module ActiveSupport
|
|
16
16
|
pid
|
17
17
|
end
|
18
18
|
end
|
19
|
+
ruby2_keywords(:fork) if respond_to?(:ruby2_keywords, true)
|
19
20
|
end
|
20
21
|
|
21
22
|
module CoreExtPrivate
|
@@ -25,6 +26,7 @@ module ActiveSupport
|
|
25
26
|
def fork(*)
|
26
27
|
super
|
27
28
|
end
|
29
|
+
ruby2_keywords(:fork) if respond_to?(:ruby2_keywords, true)
|
28
30
|
end
|
29
31
|
|
30
32
|
@pid = Process.pid
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require "active_support/core_ext/hash/keys"
|
4
4
|
require "active_support/core_ext/hash/reverse_merge"
|
5
5
|
require "active_support/core_ext/hash/except"
|
6
|
+
require "active_support/core_ext/hash/slice"
|
6
7
|
|
7
8
|
module ActiveSupport
|
8
9
|
# Implements a hash where keys <tt>:foo</tt> and <tt>"foo"</tt> are considered
|
@@ -113,7 +114,7 @@ module ActiveSupport
|
|
113
114
|
# <tt>ActiveSupport::HashWithIndifferentAccess</tt> or a regular +Hash+.
|
114
115
|
# In either case the merge respects the semantics of indifferent access.
|
115
116
|
#
|
116
|
-
# If the argument is a regular hash with keys +:key+ and
|
117
|
+
# If the argument is a regular hash with keys +:key+ and <tt>"key"</tt> only one
|
117
118
|
# of the values end up in the receiver, but which one is unspecified.
|
118
119
|
#
|
119
120
|
# When given a block, the value for duplicated keys will be determined
|
@@ -293,6 +294,10 @@ module ActiveSupport
|
|
293
294
|
super(convert_key(key))
|
294
295
|
end
|
295
296
|
|
297
|
+
# Returns a hash with indifferent access that includes everything except given keys.
|
298
|
+
# hash = { a: "x", b: "y", c: 10 }.with_indifferent_access
|
299
|
+
# hash.except(:a, "b") # => {c: 10}.with_indifferent_access
|
300
|
+
# hash # => { a: "x", b: "y", c: 10 }.with_indifferent_access
|
296
301
|
def except(*keys)
|
297
302
|
slice(*self.keys - keys.map { |key| convert_key(key) })
|
298
303
|
end
|
@@ -93,8 +93,7 @@ module ActiveSupport
|
|
93
93
|
return camel_cased_word unless /[A-Z-]|::/.match?(camel_cased_word)
|
94
94
|
word = camel_cased_word.to_s.gsub("::", "/")
|
95
95
|
word.gsub!(inflections.acronyms_underscore_regex) { "#{$1 && '_' }#{$2.downcase}" }
|
96
|
-
word.gsub!(/([A-Z
|
97
|
-
word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
|
96
|
+
word.gsub!(/([A-Z])(?=[A-Z][a-z])|([a-z\d])(?=[A-Z])/) { ($1 || $2) << "_" }
|
98
97
|
word.tr!("-", "_")
|
99
98
|
word.downcase!
|
100
99
|
word
|
@@ -45,7 +45,7 @@ en:
|
|
45
45
|
# Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00)
|
46
46
|
precision: 3
|
47
47
|
# Determine how rounding is performed (see BigDecimal::mode)
|
48
|
-
round_mode:
|
48
|
+
round_mode: default
|
49
49
|
# If set to true, precision will mean the number of significant digits instead
|
50
50
|
# of the number of decimal digits (1234 with precision 2 becomes 1200, 1.23543 becomes 1.2)
|
51
51
|
significant: false
|
@@ -10,13 +10,13 @@ module ActiveSupport
|
|
10
10
|
|
11
11
|
def default_normalization_form
|
12
12
|
ActiveSupport::Deprecation.warn(
|
13
|
-
"ActiveSupport::Multibyte::Unicode.default_normalization_form is deprecated and will be removed in Rails
|
13
|
+
"ActiveSupport::Multibyte::Unicode.default_normalization_form is deprecated and will be removed in Rails 7.0."
|
14
14
|
)
|
15
15
|
end
|
16
16
|
|
17
17
|
def default_normalization_form=(_)
|
18
18
|
ActiveSupport::Deprecation.warn(
|
19
|
-
"ActiveSupport::Multibyte::Unicode.default_normalization_form= is deprecated and will be removed in Rails
|
19
|
+
"ActiveSupport::Multibyte::Unicode.default_normalization_form= is deprecated and will be removed in Rails 7.0."
|
20
20
|
)
|
21
21
|
end
|
22
22
|
|
@@ -178,7 +178,7 @@ module ActiveSupport
|
|
178
178
|
#
|
179
179
|
# Subscribers using a regexp or other pattern-matching object will remain subscribed
|
180
180
|
# to all events that match their original pattern, unless those events match a string
|
181
|
-
# passed to
|
181
|
+
# passed to +unsubscribe+:
|
182
182
|
#
|
183
183
|
# subscriber = ActiveSupport::Notifications.subscribe(/render/) { }
|
184
184
|
# ActiveSupport::Notifications.unsubscribe('render_template.action_view')
|
@@ -20,14 +20,18 @@ module ActiveSupport
|
|
20
20
|
end
|
21
21
|
|
22
22
|
formatted_string =
|
23
|
-
if rounded_number.
|
24
|
-
"%00.#{precision}f" % rounded_number
|
25
|
-
else
|
23
|
+
if rounded_number.finite?
|
26
24
|
s = rounded_number.to_s("F")
|
27
|
-
s << "0" * precision
|
28
25
|
a, b = s.split(".", 2)
|
29
|
-
|
30
|
-
|
26
|
+
if precision != 0
|
27
|
+
b << "0" * precision
|
28
|
+
a << "."
|
29
|
+
a << b[0, precision]
|
30
|
+
end
|
31
|
+
a
|
32
|
+
else
|
33
|
+
# Infinity/NaN
|
34
|
+
"%f" % rounded_number
|
31
35
|
end
|
32
36
|
else
|
33
37
|
formatted_string = rounded_number
|
@@ -13,7 +13,7 @@ module ActiveSupport
|
|
13
13
|
precision = absolute_precision(number)
|
14
14
|
return number unless precision
|
15
15
|
|
16
|
-
rounded_number = convert_to_decimal(number).round(precision, options.fetch(:round_mode, :default))
|
16
|
+
rounded_number = convert_to_decimal(number).round(precision, options.fetch(:round_mode, :default).to_sym)
|
17
17
|
rounded_number.zero? ? rounded_number.abs : rounded_number # prevent showing negative zeros
|
18
18
|
end
|
19
19
|
|
@@ -33,7 +33,7 @@ module ActiveSupport
|
|
33
33
|
#
|
34
34
|
# ==== Options
|
35
35
|
#
|
36
|
-
# * <tt>:mask</tt> - A replaced object when filtered. Defaults to
|
36
|
+
# * <tt>:mask</tt> - A replaced object when filtered. Defaults to <tt>"[FILTERED]"</tt>.
|
37
37
|
def initialize(filters = [], mask: FILTERED)
|
38
38
|
@filters = filters
|
39
39
|
@mask = mask
|
@@ -87,7 +87,7 @@ module ActiveSupport
|
|
87
87
|
if app.config.active_support.use_sha1_digests
|
88
88
|
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
89
89
|
config.active_support.use_sha1_digests is deprecated and will
|
90
|
-
be removed from Rails
|
90
|
+
be removed from Rails 7.0. Use
|
91
91
|
config.active_support.hash_digest_class = ::Digest::SHA1 instead.
|
92
92
|
MSG
|
93
93
|
ActiveSupport::Digest.hash_digest_class = ::Digest::SHA1
|
@@ -31,7 +31,7 @@ module ActiveSupport
|
|
31
31
|
# the secret length. This should be considered when using secure_compare
|
32
32
|
# to compare weak, short secrets to user input.
|
33
33
|
def secure_compare(a, b)
|
34
|
-
a.
|
34
|
+
a.bytesize == b.bytesize && fixed_length_secure_compare(a, b)
|
35
35
|
end
|
36
36
|
module_function :secure_compare
|
37
37
|
end
|
@@ -189,7 +189,7 @@ module ActiveSupport
|
|
189
189
|
error = "#{expression.inspect} didn't change"
|
190
190
|
error = "#{error}. It was already #{to}" if before == to
|
191
191
|
error = "#{message}.\n#{error}" if message
|
192
|
-
|
192
|
+
refute_equal before, after, error
|
193
193
|
|
194
194
|
unless to == UNTRACKED
|
195
195
|
error = "Expected change to #{to}\n"
|
@@ -301,7 +301,7 @@ module ActiveSupport
|
|
301
301
|
alias_method :in, :+
|
302
302
|
|
303
303
|
# Subtracts an interval of time and returns a new TimeWithZone object unless
|
304
|
-
# the other value
|
304
|
+
# the other value +acts_like?+ time. Then it will return a Float of the difference
|
305
305
|
# between the two times that represents the difference between the current
|
306
306
|
# object's time and the +other+ time.
|
307
307
|
#
|
@@ -381,6 +381,8 @@ module ActiveSupport
|
|
381
381
|
# If the string is invalid then an +ArgumentError+ will be raised unlike +parse+
|
382
382
|
# which usually returns +nil+ when given an invalid date string.
|
383
383
|
def iso8601(str)
|
384
|
+
raise ArgumentError, "invalid date" if str.nil?
|
385
|
+
|
384
386
|
parts = Date._iso8601(str)
|
385
387
|
|
386
388
|
raise ArgumentError, "invalid date" if parts.empty?
|
@@ -508,7 +510,7 @@ module ActiveSupport
|
|
508
510
|
# Time#in_time_zone() instead.
|
509
511
|
#
|
510
512
|
# As of tzinfo 2, utc_to_local returns a Time with a non-zero utc_offset.
|
511
|
-
# See the
|
513
|
+
# See the +utc_to_local_returns_utc_offset_times+ config for more info.
|
512
514
|
def utc_to_local(time)
|
513
515
|
tzinfo.utc_to_local(time).yield_self do |t|
|
514
516
|
ActiveSupport.utc_to_local_returns_utc_offset_times ?
|
data/lib/active_support.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
#--
|
4
|
-
# Copyright (c) 2005-
|
4
|
+
# Copyright (c) 2005-2022 David Heinemeier Hansson
|
5
5
|
#
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining
|
7
7
|
# a copy of this software and associated documentation files (the
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activesupport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1.
|
4
|
+
version: 6.1.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -357,11 +357,12 @@ licenses:
|
|
357
357
|
- MIT
|
358
358
|
metadata:
|
359
359
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
360
|
-
changelog_uri: https://github.com/rails/rails/blob/v6.1.
|
361
|
-
documentation_uri: https://api.rubyonrails.org/v6.1.
|
360
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.1.7.3/activesupport/CHANGELOG.md
|
361
|
+
documentation_uri: https://api.rubyonrails.org/v6.1.7.3/
|
362
362
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
363
|
-
source_code_uri: https://github.com/rails/rails/tree/v6.1.
|
364
|
-
|
363
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.1.7.3/activesupport
|
364
|
+
rubygems_mfa_required: 'true'
|
365
|
+
post_install_message:
|
365
366
|
rdoc_options:
|
366
367
|
- "--encoding"
|
367
368
|
- UTF-8
|
@@ -378,8 +379,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
378
379
|
- !ruby/object:Gem::Version
|
379
380
|
version: '0'
|
380
381
|
requirements: []
|
381
|
-
rubygems_version: 3.
|
382
|
-
signing_key:
|
382
|
+
rubygems_version: 3.4.3
|
383
|
+
signing_key:
|
383
384
|
specification_version: 4
|
384
385
|
summary: A toolkit of support libraries and Ruby core extensions extracted from the
|
385
386
|
Rails framework.
|