activesupport 7.2.0.beta2 → 7.2.0.beta3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64a68e8272dc370b1b26c76cfc52990f1d55b0356e177baa1f6b913bf0064945
4
- data.tar.gz: 57262080af9d7a9727fb2ac430f2fdeefd98714c0c47c899af1ea3a3f5ac445e
3
+ metadata.gz: ebee3f86f1ae5a137af35d239383bd331c70684d4f6ab9635d7c5801906e9f93
4
+ data.tar.gz: 0a455dc9c538504271019964e3172493cede9f99dd554cc2265bc73c99eccc74
5
5
  SHA512:
6
- metadata.gz: 145d66aa10855ae55249f6c29e8680406835c79bc1f1f8dc8d1ec6c254f2c985c7de7369760c336df537120de83d05ef20dc9c7b6426110b19a3eb717d2d9415
7
- data.tar.gz: ad780c985f5f24a1aba645ae0b9c5c425ee0dd872ddc7cc44646e6febabba0505d1f18a841fc95e1db894a7069fc884e32a7883607085c7b0a77560799ed0bb5
6
+ metadata.gz: d6c7cc205859ceaa853b4a235c242e93cfd857a1325a4a9b0e90bdf8af2490e3b3875ae77d1f3cb75bcf0ac60c1aeb159f1195b667715d1e3a940bf014cad339
7
+ data.tar.gz: 59da4cf50826bebca6bdfaca2a1c00f053fa3c3bcb12017ff4acb16fcfcfdc7b94afa07ef761644d1dfe56fc5bc6dd147b808ed5d40ec2ec46f9c208eda48ee2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## Rails 7.2.0.beta3 (July 11, 2024) ##
2
+
3
+ * Add `logger` as a dependency since it is a bundled gem candidate for Ruby 3.5
4
+
5
+ *Earlopain*
6
+
1
7
  ## Rails 7.2.0.beta2 (June 04, 2024) ##
2
8
 
3
9
  * Define `Digest::UUID.nil_uuid`, which returns the so-called nil UUID.
@@ -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(name, as: name)
15
- name = name.to_sym
16
- as = as.to_sym
17
- @methods.fetch(name) do
18
- unless @cache.method_defined?(as)
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
- @methods[name] = as
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
- @methods.each do |name, as|
30
- owner.define_method(name, @cache.instance_method(as))
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(name, namespace:, as: name, &block)
56
- @namespaces[namespace].define_cached_method(name, as: as, &block)
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
- compare_without_coercion(other.to_time)
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
@@ -10,7 +10,7 @@ module ActiveSupport
10
10
  MAJOR = 7
11
11
  MINOR = 2
12
12
  TINY = 0
13
- PRE = "beta2"
13
+ PRE = "beta3"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  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 source_location_eval?
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
@@ -2,7 +2,6 @@
2
2
 
3
3
  require "active_support/core_ext/module/delegation"
4
4
  require "active_support/core_ext/object/blank"
5
- require "logger"
6
5
  require "active_support/logger"
7
6
 
8
7
  module ActiveSupport
@@ -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.to_time.change(usec: 0)
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)+
@@ -332,7 +332,7 @@ module ActiveSupport
332
332
  #
333
333
  def -(other)
334
334
  if other.acts_like?(:time)
335
- to_time - other.to_time
335
+ getutc - other.getutc
336
336
  elsif duration_of_variable_length?(other)
337
337
  method_missing(:-, other)
338
338
  else
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.beta2
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-06-04 00:00:00.000000000 Z
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.beta2/activesupport/CHANGELOG.md
442
- documentation_uri: https://api.rubyonrails.org/v7.2.0.beta2/
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.beta2/activesupport
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: 1.3.1
475
+ version: '0'
462
476
  requirements: []
463
- rubygems_version: 3.3.27
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