activesupport 7.0.2.3 → 7.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 +36 -0
- data/lib/active_support/backtrace_cleaner.rb +2 -2
- data/lib/active_support/cache/mem_cache_store.rb +21 -5
- data/lib/active_support/cache/memory_store.rb +1 -1
- data/lib/active_support/cache/redis_cache_store.rb +17 -11
- data/lib/active_support/cache/strategy/local_cache.rb +3 -0
- data/lib/active_support/cache.rb +122 -114
- data/lib/active_support/callbacks.rb +5 -5
- data/lib/active_support/configurable.rb +2 -2
- data/lib/active_support/core_ext/array/conversions.rb +0 -1
- data/lib/active_support/core_ext/array/inquiry.rb +2 -2
- data/lib/active_support/core_ext/date/calculations.rb +5 -5
- data/lib/active_support/core_ext/date/conversions.rb +3 -3
- data/lib/active_support/core_ext/date_and_time/calculations.rb +4 -4
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +1 -1
- data/lib/active_support/core_ext/enumerable.rb +26 -9
- data/lib/active_support/core_ext/hash/conversions.rb +0 -1
- data/lib/active_support/core_ext/hash/indifferent_access.rb +3 -3
- data/lib/active_support/core_ext/kernel/singleton_class.rb +1 -1
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +4 -4
- data/lib/active_support/core_ext/numeric/conversions.rb +1 -1
- data/lib/active_support/core_ext/object/json.rb +1 -1
- data/lib/active_support/core_ext/range/overlaps.rb +1 -1
- data/lib/active_support/core_ext/securerandom.rb +1 -1
- data/lib/active_support/core_ext/string/conversions.rb +2 -2
- data/lib/active_support/core_ext/string/inquiry.rb +1 -1
- data/lib/active_support/core_ext/string/output_safety.rb +30 -2
- data/lib/active_support/core_ext/time/calculations.rb +2 -2
- data/lib/active_support/core_ext/time/zones.rb +3 -3
- data/lib/active_support/deprecation/behaviors.rb +4 -4
- data/lib/active_support/deprecation/proxy_wrappers.rb +1 -1
- data/lib/active_support/deprecation.rb +1 -1
- data/lib/active_support/encrypted_file.rb +12 -0
- data/lib/active_support/error_reporter.rb +2 -2
- data/lib/active_support/evented_file_update_checker.rb +2 -4
- data/lib/active_support/gem_version.rb +3 -3
- data/lib/active_support/inflector/transliterate.rb +1 -1
- data/lib/active_support/isolated_execution_state.rb +8 -0
- data/lib/active_support/key_generator.rb +4 -4
- data/lib/active_support/lazy_load_hooks.rb +28 -4
- data/lib/active_support/log_subscriber/test_helper.rb +2 -2
- data/lib/active_support/log_subscriber.rb +2 -2
- data/lib/active_support/message_encryptor.rb +4 -3
- data/lib/active_support/notifications.rb +8 -2
- data/lib/active_support/option_merger.rb +2 -2
- data/lib/active_support/ordered_options.rb +1 -1
- data/lib/active_support/railtie.rb +5 -5
- data/lib/active_support/rescuable.rb +10 -10
- data/lib/active_support/secure_compare_rotator.rb +1 -1
- data/lib/active_support/test_case.rb +4 -0
- data/lib/active_support/testing/assertions.rb +1 -1
- data/lib/active_support/time_with_zone.rb +6 -7
- data/lib/active_support/values/time_zone.rb +5 -5
- data/lib/active_support/version.rb +1 -1
- metadata +6 -6
@@ -4,7 +4,7 @@ require "active_support/notifications/instrumenter"
|
|
4
4
|
require "active_support/notifications/fanout"
|
5
5
|
|
6
6
|
module ActiveSupport
|
7
|
-
# = Notifications
|
7
|
+
# = \Notifications
|
8
8
|
#
|
9
9
|
# <tt>ActiveSupport::Notifications</tt> provides an instrumentation API for
|
10
10
|
# Ruby.
|
@@ -84,7 +84,7 @@ module ActiveSupport
|
|
84
84
|
# event.payload[:exception] # => ["ArgumentError", "Invalid value"]
|
85
85
|
# event.payload[:exception_object] # => #<ArgumentError: Invalid value>
|
86
86
|
#
|
87
|
-
# As the earlier example depicts, the class
|
87
|
+
# As the earlier example depicts, the class ActiveSupport::Notifications::Event
|
88
88
|
# is able to take the arguments as they come and provide an object-oriented
|
89
89
|
# interface to that data.
|
90
90
|
#
|
@@ -244,6 +244,12 @@ module ActiveSupport
|
|
244
244
|
notifier.subscribe(pattern, callback, monotonic: false, &block)
|
245
245
|
end
|
246
246
|
|
247
|
+
# Performs the same functionality as #subscribe, but the +start+ and
|
248
|
+
# +finish+ block arguments are in monotonic time instead of wall-clock
|
249
|
+
# time. Monotonic time will not jump forward or backward (due to NTP or
|
250
|
+
# Daylights Savings). Use +monotonic_subscribe+ when accuracy of time
|
251
|
+
# duration is important. For example, computing elapsed time between
|
252
|
+
# two events.
|
247
253
|
def monotonic_subscribe(pattern = nil, callback = nil, &block)
|
248
254
|
notifier.subscribe(pattern, callback, monotonic: true, &block)
|
249
255
|
end
|
@@ -15,8 +15,8 @@ module ActiveSupport
|
|
15
15
|
private
|
16
16
|
def method_missing(method, *arguments, &block)
|
17
17
|
options = nil
|
18
|
-
if arguments.first.is_a?(Proc)
|
19
|
-
proc = arguments.
|
18
|
+
if arguments.size == 1 && arguments.first.is_a?(Proc)
|
19
|
+
proc = arguments.shift
|
20
20
|
arguments << lambda { |*args| @options.deep_merge(proc.call(*args)) }
|
21
21
|
elsif arguments.last.respond_to?(:to_hash)
|
22
22
|
options = @options.deep_merge(arguments.pop)
|
@@ -68,7 +68,7 @@ module ActiveSupport
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
-
# +InheritableOptions+ provides a constructor to build an
|
71
|
+
# +InheritableOptions+ provides a constructor to build an OrderedOptions
|
72
72
|
# hash inherited from another hash.
|
73
73
|
#
|
74
74
|
# Use this if you already have some hash and you want to create a new one based on it.
|
@@ -11,8 +11,10 @@ module ActiveSupport
|
|
11
11
|
config.eager_load_namespaces << ActiveSupport
|
12
12
|
|
13
13
|
initializer "active_support.isolation_level" do |app|
|
14
|
-
|
15
|
-
|
14
|
+
config.after_initialize do
|
15
|
+
if level = app.config.active_support.delete(:isolation_level)
|
16
|
+
ActiveSupport::IsolatedExecutionState.isolation_level = level
|
17
|
+
end
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
@@ -41,14 +43,12 @@ module ActiveSupport
|
|
41
43
|
end
|
42
44
|
|
43
45
|
initializer "active_support.reset_all_current_attributes_instances" do |app|
|
44
|
-
executor_around_test_case = app.config.active_support.executor_around_test_case
|
45
|
-
|
46
46
|
app.reloader.before_class_unload { ActiveSupport::CurrentAttributes.clear_all }
|
47
47
|
app.executor.to_run { ActiveSupport::CurrentAttributes.reset_all }
|
48
48
|
app.executor.to_complete { ActiveSupport::CurrentAttributes.reset_all }
|
49
49
|
|
50
50
|
ActiveSupport.on_load(:active_support_test_case) do
|
51
|
-
if executor_around_test_case
|
51
|
+
if app.config.active_support.executor_around_test_case
|
52
52
|
require "active_support/executor/test_helper"
|
53
53
|
include ActiveSupport::Executor::TestHelper
|
54
54
|
else
|
@@ -30,20 +30,20 @@ module ActiveSupport
|
|
30
30
|
# any.
|
31
31
|
#
|
32
32
|
# class ApplicationController < ActionController::Base
|
33
|
-
# rescue_from User::NotAuthorized, with: :deny_access
|
34
|
-
# rescue_from ActiveRecord::RecordInvalid, with: :
|
33
|
+
# rescue_from User::NotAuthorized, with: :deny_access
|
34
|
+
# rescue_from ActiveRecord::RecordInvalid, with: :show_record_errors
|
35
35
|
#
|
36
|
-
# rescue_from
|
37
|
-
#
|
36
|
+
# rescue_from "MyApp::BaseError" do |exception|
|
37
|
+
# redirect_to root_url, alert: exception.message
|
38
38
|
# end
|
39
39
|
#
|
40
40
|
# private
|
41
41
|
# def deny_access
|
42
|
-
#
|
42
|
+
# head :forbidden
|
43
43
|
# end
|
44
44
|
#
|
45
|
-
# def
|
46
|
-
# exception.record.
|
45
|
+
# def show_record_errors(exception)
|
46
|
+
# redirect_back_or_to root_url, alert: exception.record.errors.full_messages.to_sentence
|
47
47
|
# end
|
48
48
|
# end
|
49
49
|
#
|
@@ -74,12 +74,12 @@ module ActiveSupport
|
|
74
74
|
# Matches an exception to a handler based on the exception class.
|
75
75
|
#
|
76
76
|
# If no handler matches the exception, check for a handler matching the
|
77
|
-
# (optional) exception.cause
|
77
|
+
# (optional) +exception.cause+. If no handler matches the exception or its
|
78
78
|
# cause, this returns +nil+, so you can deal with unhandled exceptions.
|
79
79
|
# Be sure to re-raise unhandled exceptions if this is what you expect.
|
80
80
|
#
|
81
81
|
# begin
|
82
|
-
#
|
82
|
+
# # ...
|
83
83
|
# rescue => exception
|
84
84
|
# rescue_with_handler(exception) || raise
|
85
85
|
# end
|
@@ -160,7 +160,7 @@ module ActiveSupport
|
|
160
160
|
end
|
161
161
|
|
162
162
|
# Delegates to the class method, but uses the instance as the subject for
|
163
|
-
# rescue_from handlers (method calls, instance_exec blocks).
|
163
|
+
# rescue_from handlers (method calls, +instance_exec+ blocks).
|
164
164
|
def rescue_with_handler(exception)
|
165
165
|
self.class.rescue_with_handler exception, object: self
|
166
166
|
end
|
@@ -4,7 +4,7 @@ require "active_support/security_utils"
|
|
4
4
|
require "active_support/messages/rotator"
|
5
5
|
|
6
6
|
module ActiveSupport
|
7
|
-
# The ActiveSupport::SecureCompareRotator is a wrapper around
|
7
|
+
# The ActiveSupport::SecureCompareRotator is a wrapper around ActiveSupport::SecurityUtils.secure_compare
|
8
8
|
# and allows you to rotate a previously defined value to a new one.
|
9
9
|
#
|
10
10
|
# It can be used as follow:
|
@@ -159,7 +159,7 @@ module ActiveSupport
|
|
159
159
|
# @object = 42
|
160
160
|
# end
|
161
161
|
#
|
162
|
-
# The keyword arguments
|
162
|
+
# The keyword arguments +:from+ and +:to+ can be given to specify the
|
163
163
|
# expected initial value and the expected value after the block was
|
164
164
|
# executed.
|
165
165
|
#
|
@@ -13,7 +13,7 @@ module ActiveSupport
|
|
13
13
|
# system's <tt>ENV['TZ']</tt> zone.
|
14
14
|
#
|
15
15
|
# You shouldn't ever need to create a TimeWithZone instance directly via +new+.
|
16
|
-
# Instead use methods +local+, +parse+, +at
|
16
|
+
# Instead use methods +local+, +parse+, +at+, and +now+ on TimeZone instances,
|
17
17
|
# and +in_time_zone+ on Time and DateTime instances.
|
18
18
|
#
|
19
19
|
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
|
@@ -78,7 +78,7 @@ module ActiveSupport
|
|
78
78
|
alias_method :getutc, :utc
|
79
79
|
alias_method :gmtime, :utc
|
80
80
|
|
81
|
-
# Returns the underlying TZInfo::TimezonePeriod
|
81
|
+
# Returns the underlying <tt>TZInfo::TimezonePeriod</tt>.
|
82
82
|
def period
|
83
83
|
@period ||= time_zone.period_for_utc(@utc)
|
84
84
|
end
|
@@ -337,9 +337,8 @@ module ActiveSupport
|
|
337
337
|
alias_method :in, :+
|
338
338
|
|
339
339
|
# Subtracts an interval of time and returns a new TimeWithZone object unless
|
340
|
-
# the other value +acts_like?+ time.
|
341
|
-
#
|
342
|
-
# object's time and the +other+ time.
|
340
|
+
# the other value +acts_like?+ time. In which case, it will subtract the
|
341
|
+
# other time and return the difference in seconds as a Float.
|
343
342
|
#
|
344
343
|
# Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)'
|
345
344
|
# now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00
|
@@ -395,8 +394,8 @@ module ActiveSupport
|
|
395
394
|
# Returns a new +ActiveSupport::TimeWithZone+ where one or more of the elements have
|
396
395
|
# been changed according to the +options+ parameter. The time options (<tt>:hour</tt>,
|
397
396
|
# <tt>:min</tt>, <tt>:sec</tt>, <tt>:usec</tt>, <tt>:nsec</tt>) reset cascadingly,
|
398
|
-
# so if only the hour is passed, then minute, sec, usec and nsec is set to 0. If the
|
399
|
-
# hour and minute is passed, then sec, usec and nsec is set to 0. The +options+
|
397
|
+
# so if only the hour is passed, then minute, sec, usec, and nsec is set to 0. If the
|
398
|
+
# hour and minute is passed, then sec, usec, and nsec is set to 0. The +options+
|
400
399
|
# parameter takes a hash with any of these keys: <tt>:year</tt>, <tt>:month</tt>,
|
401
400
|
# <tt>:day</tt>, <tt>:hour</tt>, <tt>:min</tt>, <tt>:sec</tt>, <tt>:usec</tt>,
|
402
401
|
# <tt>:nsec</tt>, <tt>:offset</tt>, <tt>:zone</tt>. Pass either <tt>:usec</tt>
|
@@ -4,16 +4,16 @@ require "tzinfo"
|
|
4
4
|
require "concurrent/map"
|
5
5
|
|
6
6
|
module ActiveSupport
|
7
|
-
# The TimeZone class serves as a wrapper around TZInfo::Timezone instances.
|
7
|
+
# The TimeZone class serves as a wrapper around <tt>TZInfo::Timezone</tt> instances.
|
8
8
|
# It allows us to do the following:
|
9
9
|
#
|
10
10
|
# * Limit the set of zones provided by TZInfo to a meaningful subset of 134
|
11
11
|
# zones.
|
12
12
|
# * Retrieve and display zones with a friendlier name
|
13
13
|
# (e.g., "Eastern Time (US & Canada)" instead of "America/New_York").
|
14
|
-
# * Lazily load TZInfo::Timezone instances only when they're needed.
|
14
|
+
# * Lazily load <tt>TZInfo::Timezone</tt> instances only when they're needed.
|
15
15
|
# * Create ActiveSupport::TimeWithZone instances via TimeZone's +local+,
|
16
|
-
# +parse+, +at
|
16
|
+
# +parse+, +at+, and +now+ methods.
|
17
17
|
#
|
18
18
|
# If you set <tt>config.time_zone</tt> in the Rails Application, you can
|
19
19
|
# access this TimeZone object via <tt>Time.zone</tt>:
|
@@ -543,13 +543,13 @@ module ActiveSupport
|
|
543
543
|
tzinfo.local_to_utc(time, dst)
|
544
544
|
end
|
545
545
|
|
546
|
-
# Available so that TimeZone instances respond like TZInfo::Timezone
|
546
|
+
# Available so that TimeZone instances respond like <tt>TZInfo::Timezone</tt>
|
547
547
|
# instances.
|
548
548
|
def period_for_utc(time)
|
549
549
|
tzinfo.period_for_utc(time)
|
550
550
|
end
|
551
551
|
|
552
|
-
# Available so that TimeZone instances respond like TZInfo::Timezone
|
552
|
+
# Available so that TimeZone instances respond like <tt>TZInfo::Timezone</tt>
|
553
553
|
# instances.
|
554
554
|
def period_for_local(time, dst = true)
|
555
555
|
tzinfo.period_for_local(time, dst) { |periods| periods.last }
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require_relative "gem_version"
|
4
4
|
|
5
5
|
module ActiveSupport
|
6
|
-
# Returns the version of
|
6
|
+
# Returns the currently loaded version of Active Support as a <tt>Gem::Version</tt>.
|
7
7
|
def self.version
|
8
8
|
gem_version
|
9
9
|
end
|
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: 7.0.
|
4
|
+
version: 7.0.4
|
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: 2022-
|
11
|
+
date: 2022-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -359,10 +359,10 @@ 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/v7.0.
|
363
|
-
documentation_uri: https://api.rubyonrails.org/v7.0.
|
362
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.0.4/activesupport/CHANGELOG.md
|
363
|
+
documentation_uri: https://api.rubyonrails.org/v7.0.4/
|
364
364
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
365
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.0.
|
365
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.0.4/activesupport
|
366
366
|
rubygems_mfa_required: 'true'
|
367
367
|
post_install_message:
|
368
368
|
rdoc_options:
|
@@ -381,7 +381,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
381
381
|
- !ruby/object:Gem::Version
|
382
382
|
version: '0'
|
383
383
|
requirements: []
|
384
|
-
rubygems_version: 3.
|
384
|
+
rubygems_version: 3.3.3
|
385
385
|
signing_key:
|
386
386
|
specification_version: 4
|
387
387
|
summary: A toolkit of support libraries and Ruby core extensions extracted from the
|