activesupport 6.1.0.rc1 → 6.1.0.rc2
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 +7 -0
- data/lib/active_support/cache.rb +5 -5
- data/lib/active_support/cache/memory_store.rb +8 -0
- data/lib/active_support/cache/strategy/local_cache.rb +7 -1
- data/lib/active_support/concern.rb +3 -3
- data/lib/active_support/core_ext/module/concerning.rb +3 -3
- data/lib/active_support/core_ext/regexp.rb +8 -1
- data/lib/active_support/core_ext/string/conversions.rb +1 -0
- data/lib/active_support/core_ext/string/output_safety.rb +7 -6
- data/lib/active_support/current_attributes/test_helper.rb +2 -2
- data/lib/active_support/dependencies.rb +6 -1
- data/lib/active_support/fork_tracker.rb +5 -1
- data/lib/active_support/gem_version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a801cecf8aae6d08952dcacf312cebafbeca4cbc14686a1fef35a1b828a3cf0
|
4
|
+
data.tar.gz: fa4bcb04c962537481e6d7cc085ab531dd9453e58ce63f005d400c157a3c8941
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8924d63480e794f63b392f28413423989c411a1266b9d4252fa1a022a5b8b2c6b6bc10e27b2274485a52ad4c355ec2796e49c8a2a2a82efe65c9689d6a418006
|
7
|
+
data.tar.gz: fa558b277555caff9fa9e76084ffd58b370d7ad79f30189b9b4c064f9d441975f51351c2c3a21f42e28d7a11b8d7bc9a6fe465ae4f2766278638cc7c269a1341
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## Rails 6.1.0.rc2 (December 01, 2020) ##
|
2
|
+
|
3
|
+
* Ensure `MemoryStore` disables compression by default. Reverts behavior of
|
4
|
+
`MemoryStore` to its prior rails `5.1` behavior.
|
5
|
+
|
6
|
+
*Max Gurewitz*
|
7
|
+
|
1
8
|
## Rails 6.1.0.rc1 (November 02, 2020) ##
|
2
9
|
|
3
10
|
* Calling `iso8601` on negative durations retains the negative sign on individual
|
data/lib/active_support/cache.rb
CHANGED
@@ -324,7 +324,7 @@ module ActiveSupport
|
|
324
324
|
|
325
325
|
entry = nil
|
326
326
|
instrument(:read, name, options) do |payload|
|
327
|
-
cached_entry = read_entry(key, **options) unless options[:force]
|
327
|
+
cached_entry = read_entry(key, **options, event: payload) unless options[:force]
|
328
328
|
entry = handle_expired_entry(cached_entry, key, options)
|
329
329
|
entry = nil if entry && entry.mismatched?(normalize_version(name, options))
|
330
330
|
payload[:super_operation] = :fetch if payload
|
@@ -358,7 +358,7 @@ module ActiveSupport
|
|
358
358
|
version = normalize_version(name, options)
|
359
359
|
|
360
360
|
instrument(:read, name, options) do |payload|
|
361
|
-
entry = read_entry(key, **options)
|
361
|
+
entry = read_entry(key, **options, event: payload)
|
362
362
|
|
363
363
|
if entry
|
364
364
|
if entry.expired?
|
@@ -390,7 +390,7 @@ module ActiveSupport
|
|
390
390
|
options = merged_options(options)
|
391
391
|
|
392
392
|
instrument :read_multi, names, options do |payload|
|
393
|
-
read_multi_entries(names, **options).tap do |results|
|
393
|
+
read_multi_entries(names, **options, event: payload).tap do |results|
|
394
394
|
payload[:hits] = results.keys
|
395
395
|
end
|
396
396
|
end
|
@@ -500,8 +500,8 @@ module ActiveSupport
|
|
500
500
|
def exist?(name, options = nil)
|
501
501
|
options = merged_options(options)
|
502
502
|
|
503
|
-
instrument(:exist?, name) do
|
504
|
-
entry = read_entry(normalize_key(name, options), **options)
|
503
|
+
instrument(:exist?, name) do |payload|
|
504
|
+
entry = read_entry(normalize_key(name, options), **options, event: payload)
|
505
505
|
(entry && !entry.expired? && !entry.mismatched?(normalize_version(name, options))) || false
|
506
506
|
end
|
507
507
|
end
|
@@ -16,6 +16,12 @@ module ActiveSupport
|
|
16
16
|
# a cleanup will occur which tries to prune the cache down to three quarters
|
17
17
|
# of the maximum size by removing the least recently used entries.
|
18
18
|
#
|
19
|
+
# Unlike other Cache store implementations, MemoryStore does not compress
|
20
|
+
# values by default. MemoryStore does not benefit from compression as much
|
21
|
+
# as other Store implementations, as it does not send data over a network.
|
22
|
+
# However, when compression is enabled, it still pays the full cost of
|
23
|
+
# compression in terms of cpu use.
|
24
|
+
#
|
19
25
|
# MemoryStore is thread-safe.
|
20
26
|
class MemoryStore < Store
|
21
27
|
module DupCoder # :nodoc:
|
@@ -37,6 +43,8 @@ module ActiveSupport
|
|
37
43
|
|
38
44
|
def initialize(options = nil)
|
39
45
|
options ||= {}
|
46
|
+
# Disable compression by default.
|
47
|
+
options[:compress] ||= false
|
40
48
|
super(options)
|
41
49
|
@data = {}
|
42
50
|
@max_size = options[:size] || 32.megabytes
|
@@ -130,7 +130,13 @@ module ActiveSupport
|
|
130
130
|
private
|
131
131
|
def read_entry(key, **options)
|
132
132
|
if cache = local_cache
|
133
|
-
|
133
|
+
hit = true
|
134
|
+
value = cache.fetch_entry(key) do
|
135
|
+
hit = false
|
136
|
+
super
|
137
|
+
end
|
138
|
+
options[:event][:store] = cache.class.name if hit && options[:event]
|
139
|
+
value
|
134
140
|
else
|
135
141
|
super
|
136
142
|
end
|
@@ -102,11 +102,11 @@ module ActiveSupport
|
|
102
102
|
#
|
103
103
|
# === Prepending concerns
|
104
104
|
#
|
105
|
-
# Just like
|
106
|
-
#
|
105
|
+
# Just like <tt>include</tt>, concerns also support <tt>prepend</tt> with a corresponding
|
106
|
+
# <tt>prepended do</tt> callback. <tt>module ClassMethods</tt> or <tt>class_methods do</tt> are
|
107
107
|
# prepended as well.
|
108
108
|
#
|
109
|
-
#
|
109
|
+
# <tt>prepend</tt> is also used for any dependencies.
|
110
110
|
module Concern
|
111
111
|
class MultipleIncludedBlocks < StandardError #:nodoc:
|
112
112
|
def initialize
|
@@ -105,10 +105,10 @@ class Module
|
|
105
105
|
# * clean up monolithic junk-drawer classes by separating their concerns, and
|
106
106
|
# * stop leaning on protected/private for crude "this is internal stuff" modularity.
|
107
107
|
#
|
108
|
-
# === Prepending
|
108
|
+
# === Prepending concerning
|
109
109
|
#
|
110
|
-
#
|
111
|
-
# concern instead of using
|
110
|
+
# <tt>concerning</tt> supports a <tt>prepend: true</tt> argument which will <tt>prepend</tt> the
|
111
|
+
# concern instead of using <tt>include</tt> for it.
|
112
112
|
module Concerning
|
113
113
|
# Define a new concern and mix it in.
|
114
114
|
def concerning(topic, prepend: false, &block)
|
@@ -1,6 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class Regexp
|
3
|
+
class Regexp
|
4
|
+
# Returns +true+ if the regexp has the multiline flag set.
|
5
|
+
#
|
6
|
+
# (/./).multiline? # => false
|
7
|
+
# (/./m).multiline? # => true
|
8
|
+
#
|
9
|
+
# Regexp.new(".").multiline? # => false
|
10
|
+
# Regexp.new(".", Regexp::MULTILINE).multiline? # => true
|
4
11
|
def multiline?
|
5
12
|
options & MULTILINE == MULTILINE
|
6
13
|
end
|
@@ -18,6 +18,7 @@ class String
|
|
18
18
|
# "2012-12-13T06:12".to_time # => 2012-12-13 06:12:00 +0100
|
19
19
|
# "2012-12-13T06:12".to_time(:utc) # => 2012-12-13 06:12:00 UTC
|
20
20
|
# "12/13/2012".to_time # => ArgumentError: argument out of range
|
21
|
+
# "1604326192".to_time # => ArgumentError: argument out of range
|
21
22
|
def to_time(form = :local)
|
22
23
|
parts = Date._parse(self, false)
|
23
24
|
used_keys = %i(year mon mday hour min sec sec_fraction offset)
|
@@ -134,7 +134,7 @@ module ActiveSupport #:nodoc:
|
|
134
134
|
class SafeBuffer < String
|
135
135
|
UNSAFE_STRING_METHODS = %w(
|
136
136
|
capitalize chomp chop delete delete_prefix delete_suffix
|
137
|
-
downcase lstrip next reverse rstrip slice squeeze strip
|
137
|
+
downcase lstrip next reverse rstrip scrub slice squeeze strip
|
138
138
|
succ swapcase tr tr_s unicode_normalize upcase
|
139
139
|
)
|
140
140
|
|
@@ -152,12 +152,12 @@ module ActiveSupport #:nodoc:
|
|
152
152
|
|
153
153
|
def [](*args)
|
154
154
|
if html_safe?
|
155
|
-
|
155
|
+
new_string = super
|
156
156
|
|
157
|
-
|
158
|
-
new_safe_buffer.instance_variable_set :@html_safe, true
|
159
|
-
end
|
157
|
+
return unless new_string
|
160
158
|
|
159
|
+
new_safe_buffer = new_string.is_a?(SafeBuffer) ? new_string : SafeBuffer.new(new_string)
|
160
|
+
new_safe_buffer.instance_variable_set :@html_safe, true
|
161
161
|
new_safe_buffer
|
162
162
|
else
|
163
163
|
to_str[*args]
|
@@ -213,7 +213,8 @@ module ActiveSupport #:nodoc:
|
|
213
213
|
end
|
214
214
|
|
215
215
|
def *(*)
|
216
|
-
|
216
|
+
new_string = super
|
217
|
+
new_safe_buffer = new_string.is_a?(SafeBuffer) ? new_string : SafeBuffer.new(new_string)
|
217
218
|
new_safe_buffer.instance_variable_set(:@html_safe, @html_safe)
|
218
219
|
new_safe_buffer
|
219
220
|
end
|
@@ -375,7 +375,12 @@ module ActiveSupport #:nodoc:
|
|
375
375
|
require_or_load(path || file_name)
|
376
376
|
rescue LoadError => load_error
|
377
377
|
if file_name = load_error.message[/ -- (.*?)(\.rb)?$/, 1]
|
378
|
-
load_error.
|
378
|
+
load_error_message = if load_error.respond_to?(:original_message)
|
379
|
+
load_error.original_message
|
380
|
+
else
|
381
|
+
load_error.message
|
382
|
+
end
|
383
|
+
load_error_message.replace(message % file_name)
|
379
384
|
load_error.copy_blame!(load_error)
|
380
385
|
end
|
381
386
|
raise
|
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.0.
|
4
|
+
version: 6.1.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -357,10 +357,10 @@ 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.0.
|
361
|
-
documentation_uri: https://api.rubyonrails.org/v6.1.0.
|
360
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.1.0.rc2/activesupport/CHANGELOG.md
|
361
|
+
documentation_uri: https://api.rubyonrails.org/v6.1.0.rc2/
|
362
362
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
363
|
-
source_code_uri: https://github.com/rails/rails/tree/v6.1.0.
|
363
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.1.0.rc2/activesupport
|
364
364
|
post_install_message:
|
365
365
|
rdoc_options:
|
366
366
|
- "--encoding"
|