activesupport 6.0.3.7 → 6.0.4
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 +21 -0
- data/README.rdoc +1 -1
- data/lib/active_support/cache.rb +5 -5
- data/lib/active_support/cache/file_store.rb +3 -2
- data/lib/active_support/cache/mem_cache_store.rb +1 -0
- data/lib/active_support/cache/redis_cache_store.rb +2 -2
- data/lib/active_support/cache/strategy/local_cache.rb +1 -1
- data/lib/active_support/core_ext/hash/except.rb +1 -1
- data/lib/active_support/core_ext/object/json.rb +1 -1
- data/lib/active_support/core_ext/string/output_safety.rb +7 -6
- data/lib/active_support/core_ext/time/calculations.rb +3 -1
- data/lib/active_support/dependencies.rb +6 -1
- data/lib/active_support/deprecation/proxy_wrappers.rb +1 -1
- data/lib/active_support/gem_version.rb +2 -2
- data/lib/active_support/messages/metadata.rb +9 -1
- data/lib/active_support/number_helper/number_to_currency_converter.rb +3 -7
- data/lib/active_support/number_helper/rounding_helper.rb +1 -1
- data/lib/active_support/option_merger.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb820262bad46b77be1e8cdc8a8cf1b587bea8259ca96f838e29f539cb7d5398
|
4
|
+
data.tar.gz: 4f0afdaa454b1e344118f965b7091520f99274c21dd0c6889ea5b7aa4f04a13d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6126d9b0f4eda07d968f012618c46b867d57dae8fa9132201ce357715858238f04bb443c3f78b5cf8ae819e4e0a2f4485a6d6b6f098130130263c8838c47f79e
|
7
|
+
data.tar.gz: 2d8cf9e0702dbf20abef42494671000ee95bd7e393c4bad0f5cdfe26a9bfa6fbb3a2ebea3961f77460abf10e279eb5bd0bff91d34193d8cf986d2dbfe7ab4af7
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## Rails 6.0.4 (June 15, 2021) ##
|
2
|
+
|
3
|
+
* Fixed issue in `ActiveSupport::Cache::RedisCacheStore` not passing options
|
4
|
+
to `read_multi` causing `fetch_multi` to not work properly.
|
5
|
+
|
6
|
+
*Rajesh Sharma*
|
7
|
+
|
8
|
+
* `with_options` copies its options hash again to avoid leaking mutations.
|
9
|
+
|
10
|
+
Fixes #39343.
|
11
|
+
|
12
|
+
*Eugene Kenny*
|
13
|
+
|
14
|
+
|
1
15
|
## Rails 6.0.3.7 (May 05, 2021) ##
|
2
16
|
|
3
17
|
* No changes.
|
@@ -34,6 +48,7 @@
|
|
34
48
|
|
35
49
|
* [CVE-2020-8165] Avoid Marshal.load on raw cache value in MemCacheStore
|
36
50
|
|
51
|
+
|
37
52
|
## Rails 6.0.3 (May 06, 2020) ##
|
38
53
|
|
39
54
|
* `Array#to_sentence` no longer returns a frozen string.
|
@@ -199,6 +214,12 @@
|
|
199
214
|
|
200
215
|
## Rails 6.0.0.rc1 (April 24, 2019) ##
|
201
216
|
|
217
|
+
* Speed improvements to `Hash.except` and `HashWithIndifferentAccess#except`.
|
218
|
+
|
219
|
+
These methods now unset the `default`/`default_proc` on the returned Hash, compatible with Ruby 3.0’s native implementation.
|
220
|
+
|
221
|
+
*Timo Schilling*
|
222
|
+
|
202
223
|
* Introduce `ActiveSupport::ActionableError`.
|
203
224
|
|
204
225
|
Actionable errors let's you dispatch actions from Rails' error pages. This
|
data/README.rdoc
CHANGED
@@ -15,7 +15,7 @@ The latest version of Active Support can be installed with RubyGems:
|
|
15
15
|
|
16
16
|
Source code can be downloaded as part of the Rails project on GitHub:
|
17
17
|
|
18
|
-
* https://github.com/rails/rails/tree/
|
18
|
+
* https://github.com/rails/rails/tree/main/activesupport
|
19
19
|
|
20
20
|
|
21
21
|
== License
|
data/lib/active_support/cache.rb
CHANGED
@@ -312,7 +312,7 @@ module ActiveSupport
|
|
312
312
|
# :bar
|
313
313
|
# end
|
314
314
|
# cache.fetch('foo') # => "bar"
|
315
|
-
def fetch(name, options = nil)
|
315
|
+
def fetch(name, options = nil, &block)
|
316
316
|
if block_given?
|
317
317
|
options = merged_options(options)
|
318
318
|
key = normalize_key(name, options)
|
@@ -327,9 +327,9 @@ module ActiveSupport
|
|
327
327
|
end
|
328
328
|
|
329
329
|
if entry
|
330
|
-
get_entry_value(entry, name,
|
330
|
+
get_entry_value(entry, name, options)
|
331
331
|
else
|
332
|
-
save_block_result_to_cache(name,
|
332
|
+
save_block_result_to_cache(name, options, &block)
|
333
333
|
end
|
334
334
|
elsif options && options[:force]
|
335
335
|
raise ArgumentError, "Missing block: Calling `Cache#fetch` with `force: true` requires a block."
|
@@ -448,7 +448,7 @@ module ActiveSupport
|
|
448
448
|
payload[:hits] = reads.keys
|
449
449
|
payload[:super_operation] = :fetch_multi
|
450
450
|
|
451
|
-
write_multi(writes,
|
451
|
+
write_multi(writes, options)
|
452
452
|
|
453
453
|
ordered
|
454
454
|
end
|
@@ -712,7 +712,7 @@ module ActiveSupport
|
|
712
712
|
entry.value
|
713
713
|
end
|
714
714
|
|
715
|
-
def save_block_result_to_cache(name,
|
715
|
+
def save_block_result_to_cache(name, options)
|
716
716
|
result = instrument(:generate, name, options) do
|
717
717
|
yield(name)
|
718
718
|
end
|
@@ -16,7 +16,7 @@ module ActiveSupport
|
|
16
16
|
attr_reader :cache_path
|
17
17
|
|
18
18
|
DIR_FORMATTER = "%03X"
|
19
|
-
FILENAME_MAX_SIZE =
|
19
|
+
FILENAME_MAX_SIZE = 226 # max filename size on file system is 255, minus room for timestamp, pid, and random characters appended by Tempfile (used by atomic write)
|
20
20
|
FILEPATH_MAX_SIZE = 900 # max is 1024, plus some room
|
21
21
|
GITKEEP_FILES = [".gitkeep", ".keep"].freeze
|
22
22
|
|
@@ -74,7 +74,8 @@ module ActiveSupport
|
|
74
74
|
private
|
75
75
|
def read_entry(key, **options)
|
76
76
|
if File.exist?(key)
|
77
|
-
File.open(key) { |f| Marshal.load(f) }
|
77
|
+
entry = File.open(key) { |f| Marshal.load(f) }
|
78
|
+
entry if entry.is_a?(Cache::Entry)
|
78
79
|
end
|
79
80
|
rescue => e
|
80
81
|
logger.error("FileStoreError (#{e}): #{e.message}") if logger
|
@@ -347,7 +347,7 @@ module ActiveSupport
|
|
347
347
|
|
348
348
|
def read_multi_entries(names, **options)
|
349
349
|
if mget_capable?
|
350
|
-
read_multi_mget(*names)
|
350
|
+
read_multi_mget(*names, **options)
|
351
351
|
else
|
352
352
|
super
|
353
353
|
end
|
@@ -394,7 +394,7 @@ module ActiveSupport
|
|
394
394
|
modifiers[:nx] = unless_exist
|
395
395
|
modifiers[:px] = (1000 * expires_in.to_f).ceil if expires_in
|
396
396
|
|
397
|
-
redis.with { |c| c.set key, serialized_entry, modifiers }
|
397
|
+
redis.with { |c| c.set key, serialized_entry, **modifiers }
|
398
398
|
else
|
399
399
|
redis.with { |c| c.set key, serialized_entry }
|
400
400
|
end
|
@@ -45,7 +45,7 @@ module ActiveSupport
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
[Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass
|
48
|
+
[Enumerable, Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass].reverse_each do |klass|
|
49
49
|
klass.prepend(ActiveSupport::ToJsonWithActiveSupportEncoder)
|
50
50
|
end
|
51
51
|
|
@@ -135,7 +135,7 @@ module ActiveSupport #:nodoc:
|
|
135
135
|
class SafeBuffer < String
|
136
136
|
UNSAFE_STRING_METHODS = %w(
|
137
137
|
capitalize chomp chop delete delete_prefix delete_suffix
|
138
|
-
downcase lstrip next reverse rstrip slice squeeze strip
|
138
|
+
downcase lstrip next reverse rstrip scrub slice squeeze strip
|
139
139
|
succ swapcase tr tr_s unicode_normalize upcase
|
140
140
|
)
|
141
141
|
|
@@ -153,12 +153,12 @@ module ActiveSupport #:nodoc:
|
|
153
153
|
|
154
154
|
def [](*args)
|
155
155
|
if html_safe?
|
156
|
-
|
156
|
+
new_string = super
|
157
157
|
|
158
|
-
|
159
|
-
new_safe_buffer.instance_variable_set :@html_safe, true
|
160
|
-
end
|
158
|
+
return unless new_string
|
161
159
|
|
160
|
+
new_safe_buffer = new_string.is_a?(SafeBuffer) ? new_string : SafeBuffer.new(new_string)
|
161
|
+
new_safe_buffer.instance_variable_set :@html_safe, true
|
162
162
|
new_safe_buffer
|
163
163
|
else
|
164
164
|
to_str[*args]
|
@@ -214,7 +214,8 @@ module ActiveSupport #:nodoc:
|
|
214
214
|
end
|
215
215
|
|
216
216
|
def *(*)
|
217
|
-
|
217
|
+
new_string = super
|
218
|
+
new_safe_buffer = new_string.is_a?(SafeBuffer) ? new_string : SafeBuffer.new(new_string)
|
218
219
|
new_safe_buffer.instance_variable_set(:@html_safe, @html_safe)
|
219
220
|
new_safe_buffer
|
220
221
|
end
|
@@ -47,7 +47,9 @@ class Time
|
|
47
47
|
# Time.at can be called with a time or numerical value
|
48
48
|
time_or_number = args.first
|
49
49
|
|
50
|
-
if time_or_number.is_a?(ActiveSupport::TimeWithZone)
|
50
|
+
if time_or_number.is_a?(ActiveSupport::TimeWithZone)
|
51
|
+
at_without_coercion(time_or_number.to_r).getlocal
|
52
|
+
elsif time_or_number.is_a?(DateTime)
|
51
53
|
at_without_coercion(time_or_number.to_f).getlocal
|
52
54
|
else
|
53
55
|
at_without_coercion(time_or_number)
|
@@ -367,7 +367,12 @@ module ActiveSupport #:nodoc:
|
|
367
367
|
require_or_load(path || file_name)
|
368
368
|
rescue LoadError => load_error
|
369
369
|
if file_name = load_error.message[/ -- (.*?)(\.rb)?$/, 1]
|
370
|
-
load_error.
|
370
|
+
load_error_message = if load_error.respond_to?(:original_message)
|
371
|
+
load_error.original_message
|
372
|
+
else
|
373
|
+
load_error.message
|
374
|
+
end
|
375
|
+
load_error_message.replace(message % file_name)
|
371
376
|
load_error.copy_blame!(load_error)
|
372
377
|
end
|
373
378
|
raise
|
@@ -147,7 +147,7 @@ module ActiveSupport
|
|
147
147
|
|
148
148
|
# Don't give a deprecation warning on methods that IRB may invoke
|
149
149
|
# during tab-completion.
|
150
|
-
delegate :hash, :instance_methods, :name, to: :target
|
150
|
+
delegate :hash, :instance_methods, :name, :respond_to?, to: :target
|
151
151
|
|
152
152
|
# Returns the class of the new constant.
|
153
153
|
#
|
@@ -7,7 +7,7 @@ module ActiveSupport
|
|
7
7
|
class Metadata #:nodoc:
|
8
8
|
def initialize(message, expires_at = nil, purpose = nil)
|
9
9
|
@message, @purpose = message, purpose
|
10
|
-
@expires_at = expires_at.is_a?(String) ?
|
10
|
+
@expires_at = expires_at.is_a?(String) ? parse_expires_at(expires_at) : expires_at
|
11
11
|
end
|
12
12
|
|
13
13
|
def as_json(options = {})
|
@@ -67,6 +67,14 @@ module ActiveSupport
|
|
67
67
|
def fresh?
|
68
68
|
@expires_at.nil? || Time.now.utc < @expires_at
|
69
69
|
end
|
70
|
+
|
71
|
+
def parse_expires_at(expires_at)
|
72
|
+
if ActiveSupport.use_standard_json_time_format
|
73
|
+
Time.iso8601(expires_at)
|
74
|
+
else
|
75
|
+
Time.parse(expires_at)
|
76
|
+
end
|
77
|
+
end
|
70
78
|
end
|
71
79
|
end
|
72
80
|
end
|
@@ -9,15 +9,11 @@ module ActiveSupport
|
|
9
9
|
|
10
10
|
def convert
|
11
11
|
number = self.number.to_s.strip
|
12
|
-
number_f = number.to_f
|
13
12
|
format = options[:format]
|
14
13
|
|
15
|
-
if
|
16
|
-
|
17
|
-
|
18
|
-
unless options[:precision] == 0 && number < 0.5
|
19
|
-
format = options[:negative_format]
|
20
|
-
end
|
14
|
+
if number.sub!(/^-/, "") &&
|
15
|
+
(options[:precision] != 0 || number.to_f > 0.5)
|
16
|
+
format = options[:negative_format]
|
21
17
|
end
|
22
18
|
|
23
19
|
rounded_number = NumberToRoundedConverter.convert(number, options)
|
@@ -26,7 +26,7 @@ module ActiveSupport
|
|
26
26
|
|
27
27
|
private
|
28
28
|
def round_without_significant(number)
|
29
|
-
number = number.round(precision)
|
29
|
+
number = number.round(precision, BigDecimal.mode(BigDecimal::ROUND_MODE))
|
30
30
|
number = number.to_i if precision == 0 && number.finite?
|
31
31
|
number = number.abs if number.zero? # prevent showing negative zeros
|
32
32
|
number
|
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.0.
|
4
|
+
version: 6.0.4
|
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: 2021-
|
11
|
+
date: 2021-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -359,11 +359,11 @@ licenses:
|
|
359
359
|
- MIT
|
360
360
|
metadata:
|
361
361
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
362
|
-
changelog_uri: https://github.com/rails/rails/blob/v6.0.
|
363
|
-
documentation_uri: https://api.rubyonrails.org/v6.0.
|
362
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.0.4/activesupport/CHANGELOG.md
|
363
|
+
documentation_uri: https://api.rubyonrails.org/v6.0.4/
|
364
364
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
365
|
-
source_code_uri: https://github.com/rails/rails/tree/v6.0.
|
366
|
-
post_install_message:
|
365
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.0.4/activesupport
|
366
|
+
post_install_message:
|
367
367
|
rdoc_options:
|
368
368
|
- "--encoding"
|
369
369
|
- UTF-8
|
@@ -381,7 +381,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
381
381
|
version: '0'
|
382
382
|
requirements: []
|
383
383
|
rubygems_version: 3.1.2
|
384
|
-
signing_key:
|
384
|
+
signing_key:
|
385
385
|
specification_version: 4
|
386
386
|
summary: A toolkit of support libraries and Ruby core extensions extracted from the
|
387
387
|
Rails framework.
|