activesupport 7.2.0.beta2 → 7.2.0.beta3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/active_support/code_generator.rb +15 -10
- data/lib/active_support/core_ext/time/calculations.rb +6 -1
- data/lib/active_support/core_ext/time/compatibility.rb +16 -0
- data/lib/active_support/gem_version.rb +1 -1
- data/lib/active_support/logger_thread_safe_level.rb +0 -8
- data/lib/active_support/message_verifier.rb +12 -0
- data/lib/active_support/syntax_error_proxy.rb +1 -11
- data/lib/active_support/tagged_logging.rb +0 -1
- data/lib/active_support/testing/time_helpers.rb +3 -3
- data/lib/active_support/time_with_zone.rb +1 -1
- metadata +22 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebee3f86f1ae5a137af35d239383bd331c70684d4f6ab9635d7c5801906e9f93
|
4
|
+
data.tar.gz: 0a455dc9c538504271019964e3172493cede9f99dd554cc2265bc73c99eccc74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6c7cc205859ceaa853b4a235c242e93cfd857a1325a4a9b0e90bdf8af2490e3b3875ae77d1f3cb75bcf0ac60c1aeb159f1195b667715d1e3a940bf014cad339
|
7
|
+
data.tar.gz: 59da4cf50826bebca6bdfaca2a1c00f053fa3c3bcb12017ff4acb16fcfcfdc7b94afa07ef761644d1dfe56fc5bc6dd147b808ed5d40ec2ec46f9c208eda48ee2
|
data/CHANGELOG.md
CHANGED
@@ -9,16 +9,19 @@ module ActiveSupport
|
|
9
9
|
@cache = METHOD_CACHES[namespace]
|
10
10
|
@sources = []
|
11
11
|
@methods = {}
|
12
|
+
@canonical_methods = {}
|
12
13
|
end
|
13
14
|
|
14
|
-
def define_cached_method(
|
15
|
-
|
16
|
-
as = as.to_sym
|
17
|
-
|
18
|
-
|
15
|
+
def define_cached_method(canonical_name, as: nil)
|
16
|
+
canonical_name = canonical_name.to_sym
|
17
|
+
as = (as || canonical_name).to_sym
|
18
|
+
|
19
|
+
@methods.fetch(as) do
|
20
|
+
unless @cache.method_defined?(canonical_name) || @canonical_methods[canonical_name]
|
19
21
|
yield @sources
|
20
22
|
end
|
21
|
-
@
|
23
|
+
@canonical_methods[canonical_name] = true
|
24
|
+
@methods[as] = canonical_name
|
22
25
|
end
|
23
26
|
end
|
24
27
|
|
@@ -26,8 +29,10 @@ module ActiveSupport
|
|
26
29
|
unless @sources.empty?
|
27
30
|
@cache.module_eval("# frozen_string_literal: true\n" + @sources.join(";"), path, line)
|
28
31
|
end
|
29
|
-
@
|
30
|
-
|
32
|
+
@canonical_methods.clear
|
33
|
+
|
34
|
+
@methods.each do |as, canonical_name|
|
35
|
+
owner.define_method(as, @cache.instance_method(canonical_name))
|
31
36
|
end
|
32
37
|
end
|
33
38
|
end
|
@@ -52,8 +57,8 @@ module ActiveSupport
|
|
52
57
|
@namespaces = Hash.new { |h, k| h[k] = MethodSet.new(k) }
|
53
58
|
end
|
54
59
|
|
55
|
-
def define_cached_method(
|
56
|
-
@namespaces[namespace].define_cached_method(
|
60
|
+
def define_cached_method(canonical_name, namespace:, as: nil, &block)
|
61
|
+
@namespaces[namespace].define_cached_method(canonical_name, as: as, &block)
|
57
62
|
end
|
58
63
|
|
59
64
|
def execute
|
@@ -319,7 +319,12 @@ class Time
|
|
319
319
|
if other.class == Time
|
320
320
|
compare_without_coercion(other)
|
321
321
|
elsif other.is_a?(Time)
|
322
|
-
|
322
|
+
# also avoid ActiveSupport::TimeWithZone#to_time before Rails 8.0
|
323
|
+
if other.respond_to?(:comparable_time)
|
324
|
+
compare_without_coercion(other.comparable_time)
|
325
|
+
else
|
326
|
+
compare_without_coercion(other.to_time)
|
327
|
+
end
|
323
328
|
else
|
324
329
|
to_datetime <=> other
|
325
330
|
end
|
@@ -13,4 +13,20 @@ class Time
|
|
13
13
|
def to_time
|
14
14
|
preserve_timezone ? self : getlocal
|
15
15
|
end
|
16
|
+
|
17
|
+
def preserve_timezone # :nodoc:
|
18
|
+
active_support_local_zone == zone || super
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
@@active_support_local_tz = nil
|
23
|
+
|
24
|
+
def active_support_local_zone
|
25
|
+
@@active_support_local_zone = nil if @@active_support_local_tz != ENV["TZ"]
|
26
|
+
@@active_support_local_zone ||=
|
27
|
+
begin
|
28
|
+
@@active_support_local_tz = ENV["TZ"]
|
29
|
+
Time.new.zone
|
30
|
+
end
|
31
|
+
end
|
16
32
|
end
|
@@ -7,14 +7,6 @@ module ActiveSupport
|
|
7
7
|
module LoggerThreadSafeLevel # :nodoc:
|
8
8
|
extend ActiveSupport::Concern
|
9
9
|
|
10
|
-
Logger::Severity.constants.each do |severity|
|
11
|
-
class_eval(<<-EOT, __FILE__, __LINE__ + 1)
|
12
|
-
def #{severity.downcase}? # def debug?
|
13
|
-
Logger::#{severity} >= level # DEBUG >= level
|
14
|
-
end # end
|
15
|
-
EOT
|
16
|
-
end
|
17
|
-
|
18
10
|
def local_level
|
19
11
|
IsolatedExecutionState[local_level_key]
|
20
12
|
end
|
@@ -30,6 +30,18 @@ module ActiveSupport
|
|
30
30
|
# self.current_user = User.find(id)
|
31
31
|
# end
|
32
32
|
#
|
33
|
+
# === Signing is not encryption
|
34
|
+
#
|
35
|
+
# The signed messages are not encrypted. The payload is merely encoded (Base64 by default) and can be decoded by
|
36
|
+
# anyone. The signature is just assuring that the message wasn't tampered with. For example:
|
37
|
+
#
|
38
|
+
# message = Rails.application.message_verifier('my_purpose').generate('never put secrets here')
|
39
|
+
# # => "BAhJIhtuZXZlciBwdXQgc2VjcmV0cyBoZXJlBjoGRVQ=--a0c1c0827919da5e949e989c971249355735e140"
|
40
|
+
# Base64.decode64(message.split("--").first) # no key needed
|
41
|
+
# # => 'never put secrets here'
|
42
|
+
#
|
43
|
+
# If you also need to encrypt the contents, you must use ActiveSupport::MessageEncryptor instead.
|
44
|
+
#
|
33
45
|
# === Confine messages to a specific purpose
|
34
46
|
#
|
35
47
|
# It's not recommended to use the same verifier for different purposes in your application.
|
@@ -45,7 +45,7 @@ module ActiveSupport
|
|
45
45
|
|
46
46
|
private
|
47
47
|
def parse_message_for_trace
|
48
|
-
if
|
48
|
+
if __getobj__.to_s.start_with?("(eval")
|
49
49
|
# If the exception is coming from a call to eval, we need to keep
|
50
50
|
# the path of the file in which eval was called to ensure we can
|
51
51
|
# return the right source fragment to show the location of the
|
@@ -56,15 +56,5 @@ module ActiveSupport
|
|
56
56
|
__getobj__.to_s.split("\n")
|
57
57
|
end
|
58
58
|
end
|
59
|
-
|
60
|
-
if SyntaxError.method_defined?(:path) # Ruby 3.3+
|
61
|
-
def source_location_eval?
|
62
|
-
__getobj__.path.start_with?("(eval")
|
63
|
-
end
|
64
|
-
else # 3.2 and older versions of Ruby
|
65
|
-
def source_location_eval?
|
66
|
-
__getobj__.to_s.start_with?("(eval")
|
67
|
-
end
|
68
|
-
end
|
69
59
|
end
|
70
60
|
end
|
@@ -163,10 +163,10 @@ module ActiveSupport
|
|
163
163
|
now = date_or_time.midnight.to_time
|
164
164
|
elsif date_or_time.is_a?(String)
|
165
165
|
now = Time.zone.parse(date_or_time)
|
166
|
-
elsif with_usec
|
167
|
-
now = date_or_time.to_time
|
168
166
|
else
|
169
|
-
now = date_or_time
|
167
|
+
now = date_or_time
|
168
|
+
now = now.to_time unless now.is_a?(Time)
|
169
|
+
now = now.change(usec: 0) unless with_usec
|
170
170
|
end
|
171
171
|
|
172
172
|
# +now+ must be in local system timezone, because +Time.at(now)+
|
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.2.0.
|
4
|
+
version: 7.2.0.beta3
|
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: 2024-
|
11
|
+
date: 2024-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -140,6 +140,20 @@ dependencies:
|
|
140
140
|
- - ">="
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
name: logger
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - ">="
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: 1.4.2
|
150
|
+
type: :runtime
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: 1.4.2
|
143
157
|
description: A toolkit of support libraries and Ruby core extensions extracted from
|
144
158
|
the Rails framework. Rich support for multibyte strings, internationalization, time
|
145
159
|
zones, and testing.
|
@@ -438,10 +452,10 @@ licenses:
|
|
438
452
|
- MIT
|
439
453
|
metadata:
|
440
454
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
441
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.2.0.
|
442
|
-
documentation_uri: https://api.rubyonrails.org/v7.2.0.
|
455
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.2.0.beta3/activesupport/CHANGELOG.md
|
456
|
+
documentation_uri: https://api.rubyonrails.org/v7.2.0.beta3/
|
443
457
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
444
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.2.0.
|
458
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.2.0.beta3/activesupport
|
445
459
|
rubygems_mfa_required: 'true'
|
446
460
|
post_install_message:
|
447
461
|
rdoc_options:
|
@@ -456,11 +470,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
456
470
|
version: 3.1.0
|
457
471
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
458
472
|
requirements:
|
459
|
-
- - "
|
473
|
+
- - ">="
|
460
474
|
- !ruby/object:Gem::Version
|
461
|
-
version:
|
475
|
+
version: '0'
|
462
476
|
requirements: []
|
463
|
-
rubygems_version: 3.
|
477
|
+
rubygems_version: 3.5.11
|
464
478
|
signing_key:
|
465
479
|
specification_version: 4
|
466
480
|
summary: A toolkit of support libraries and Ruby core extensions extracted from the
|