activesupport 7.1.5.1 → 7.2.3

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.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +213 -1082
  3. data/README.rdoc +1 -1
  4. data/lib/active_support/array_inquirer.rb +1 -1
  5. data/lib/active_support/backtrace_cleaner.rb +10 -3
  6. data/lib/active_support/broadcast_logger.rb +65 -78
  7. data/lib/active_support/cache/file_store.rb +17 -12
  8. data/lib/active_support/cache/mem_cache_store.rb +29 -89
  9. data/lib/active_support/cache/memory_store.rb +7 -6
  10. data/lib/active_support/cache/null_store.rb +2 -2
  11. data/lib/active_support/cache/redis_cache_store.rb +17 -14
  12. data/lib/active_support/cache/serializer_with_fallback.rb +0 -23
  13. data/lib/active_support/cache/strategy/local_cache.rb +56 -20
  14. data/lib/active_support/cache.rb +63 -71
  15. data/lib/active_support/callbacks.rb +77 -115
  16. data/lib/active_support/core_ext/array/conversions.rb +0 -2
  17. data/lib/active_support/core_ext/benchmark.rb +1 -0
  18. data/lib/active_support/core_ext/class/attribute.rb +2 -2
  19. data/lib/active_support/core_ext/class/subclasses.rb +15 -35
  20. data/lib/active_support/core_ext/date/blank.rb +4 -0
  21. data/lib/active_support/core_ext/date/conversions.rb +0 -2
  22. data/lib/active_support/core_ext/date_and_time/compatibility.rb +28 -1
  23. data/lib/active_support/core_ext/date_time/blank.rb +4 -0
  24. data/lib/active_support/core_ext/date_time/conversions.rb +4 -6
  25. data/lib/active_support/core_ext/digest/uuid.rb +6 -0
  26. data/lib/active_support/core_ext/enumerable.rb +17 -5
  27. data/lib/active_support/core_ext/erb/util.rb +7 -2
  28. data/lib/active_support/core_ext/hash/keys.rb +4 -4
  29. data/lib/active_support/core_ext/module/attr_internal.rb +17 -6
  30. data/lib/active_support/core_ext/module/delegation.rb +20 -163
  31. data/lib/active_support/core_ext/module/deprecation.rb +1 -4
  32. data/lib/active_support/core_ext/module/introspection.rb +3 -0
  33. data/lib/active_support/core_ext/numeric/conversions.rb +3 -3
  34. data/lib/active_support/core_ext/object/blank.rb +45 -1
  35. data/lib/active_support/core_ext/object/instance_variables.rb +11 -19
  36. data/lib/active_support/core_ext/object/json.rb +1 -1
  37. data/lib/active_support/core_ext/object/try.rb +2 -2
  38. data/lib/active_support/core_ext/object/with.rb +5 -3
  39. data/lib/active_support/core_ext/pathname/blank.rb +4 -0
  40. data/lib/active_support/core_ext/range/overlap.rb +1 -1
  41. data/lib/active_support/core_ext/range/sole.rb +17 -0
  42. data/lib/active_support/core_ext/range.rb +1 -0
  43. data/lib/active_support/core_ext/securerandom.rb +4 -4
  44. data/lib/active_support/core_ext/string/conversions.rb +1 -1
  45. data/lib/active_support/core_ext/string/filters.rb +4 -4
  46. data/lib/active_support/core_ext/string/multibyte.rb +3 -3
  47. data/lib/active_support/core_ext/string/output_safety.rb +0 -7
  48. data/lib/active_support/core_ext/time/calculations.rb +18 -28
  49. data/lib/active_support/core_ext/time/compatibility.rb +24 -0
  50. data/lib/active_support/core_ext/time/conversions.rb +0 -2
  51. data/lib/active_support/core_ext/time/zones.rb +1 -1
  52. data/lib/active_support/core_ext.rb +0 -1
  53. data/lib/active_support/current_attributes.rb +45 -40
  54. data/lib/active_support/delegation.rb +202 -0
  55. data/lib/active_support/dependencies/autoload.rb +0 -12
  56. data/lib/active_support/deprecation/constant_accessor.rb +47 -26
  57. data/lib/active_support/deprecation/proxy_wrappers.rb +9 -12
  58. data/lib/active_support/deprecation/reporting.rb +7 -2
  59. data/lib/active_support/deprecation.rb +8 -5
  60. data/lib/active_support/descendants_tracker.rb +9 -87
  61. data/lib/active_support/duration/iso8601_parser.rb +2 -2
  62. data/lib/active_support/duration/iso8601_serializer.rb +1 -2
  63. data/lib/active_support/duration.rb +11 -6
  64. data/lib/active_support/encrypted_file.rb +1 -1
  65. data/lib/active_support/error_reporter.rb +46 -5
  66. data/lib/active_support/evented_file_update_checker.rb +0 -1
  67. data/lib/active_support/execution_wrapper.rb +1 -2
  68. data/lib/active_support/file_update_checker.rb +2 -2
  69. data/lib/active_support/fork_tracker.rb +2 -38
  70. data/lib/active_support/gem_version.rb +3 -3
  71. data/lib/active_support/hash_with_indifferent_access.rb +26 -24
  72. data/lib/active_support/html_safe_translation.rb +3 -0
  73. data/lib/active_support/json/decoding.rb +1 -1
  74. data/lib/active_support/json/encoding.rb +23 -5
  75. data/lib/active_support/lazy_load_hooks.rb +1 -1
  76. data/lib/active_support/log_subscriber.rb +0 -12
  77. data/lib/active_support/logger.rb +15 -2
  78. data/lib/active_support/logger_thread_safe_level.rb +0 -8
  79. data/lib/active_support/message_encryptors.rb +2 -2
  80. data/lib/active_support/message_pack/extensions.rb +15 -2
  81. data/lib/active_support/message_verifier.rb +21 -0
  82. data/lib/active_support/message_verifiers.rb +5 -3
  83. data/lib/active_support/messages/rotator.rb +5 -0
  84. data/lib/active_support/multibyte/chars.rb +6 -3
  85. data/lib/active_support/notifications/fanout.rb +4 -7
  86. data/lib/active_support/notifications/instrumenter.rb +21 -18
  87. data/lib/active_support/notifications.rb +28 -27
  88. data/lib/active_support/number_helper/number_converter.rb +2 -2
  89. data/lib/active_support/option_merger.rb +2 -2
  90. data/lib/active_support/ordered_options.rb +53 -15
  91. data/lib/active_support/proxy_object.rb +8 -5
  92. data/lib/active_support/railtie.rb +4 -11
  93. data/lib/active_support/string_inquirer.rb +1 -1
  94. data/lib/active_support/subscriber.rb +1 -0
  95. data/lib/active_support/tagged_logging.rb +0 -1
  96. data/lib/active_support/test_case.rb +3 -1
  97. data/lib/active_support/testing/assertions.rb +4 -4
  98. data/lib/active_support/testing/constant_stubbing.rb +30 -8
  99. data/lib/active_support/testing/deprecation.rb +5 -12
  100. data/lib/active_support/testing/isolation.rb +20 -8
  101. data/lib/active_support/testing/method_call_assertions.rb +2 -16
  102. data/lib/active_support/testing/parallelization/server.rb +18 -2
  103. data/lib/active_support/testing/parallelization/worker.rb +2 -2
  104. data/lib/active_support/testing/parallelization.rb +12 -1
  105. data/lib/active_support/testing/tests_without_assertions.rb +19 -0
  106. data/lib/active_support/testing/time_helpers.rb +3 -3
  107. data/lib/active_support/time_with_zone.rb +8 -4
  108. data/lib/active_support/values/time_zone.rb +7 -7
  109. data/lib/active_support/xml_mini.rb +13 -2
  110. data/lib/active_support.rb +2 -1
  111. metadata +18 -29
  112. data/lib/active_support/deprecation/instance_delegator.rb +0 -65
  113. data/lib/active_support/ruby_features.rb +0 -7
  114. data/lib/active_support/testing/strict_warnings.rb +0 -39
@@ -1,65 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActiveSupport
4
- class Deprecation
5
- module InstanceDelegator # :nodoc:
6
- def self.included(base)
7
- base.extend(ClassMethods)
8
- base.singleton_class.prepend(OverrideDelegators)
9
- end
10
-
11
- module ClassMethods # :nodoc:
12
- MUTEX = Mutex.new
13
- private_constant :MUTEX
14
-
15
- def include(included_module)
16
- included_module.instance_methods.each { |m| method_added(m) }
17
- super
18
- end
19
-
20
- def method_added(method_name)
21
- use_instead =
22
- case method_name
23
- when :silence, :behavior=, :disallowed_behavior=, :disallowed_warnings=, :silenced=, :debug=
24
- target = "(defined?(Rails.application.deprecators) ? Rails.application.deprecators : ActiveSupport::Deprecation._instance)"
25
- "Rails.application.deprecators.#{method_name}"
26
- when :warn, :deprecate_methods, :gem_name, :gem_name=, :deprecation_horizon, :deprecation_horizon=
27
- "your own Deprecation object"
28
- else
29
- "Rails.application.deprecators[framework].#{method_name} where framework is for example :active_record"
30
- end
31
- args = /[^\]]=\z/.match?(method_name) ? "arg" : "..."
32
- target ||= "ActiveSupport::Deprecation._instance"
33
- singleton_class.module_eval <<~RUBY, __FILE__, __LINE__ + 1
34
- def #{method_name}(#{args})
35
- #{target}.#{method_name}(#{args})
36
- ensure
37
- ActiveSupport.deprecator.warn("Calling #{method_name} on ActiveSupport::Deprecation is deprecated and will be removed from Rails (use #{use_instead} instead)")
38
- end
39
- RUBY
40
- end
41
-
42
- def instance
43
- ActiveSupport.deprecator.warn("ActiveSupport::Deprecation.instance is deprecated (use your own Deprecation object)")
44
- _instance
45
- end
46
-
47
- def _instance
48
- @_instance ||= MUTEX.synchronize { @_instance ||= new }
49
- end
50
- end
51
-
52
- module OverrideDelegators # :nodoc:
53
- def warn(message = nil, callstack = nil)
54
- callstack ||= caller_locations(2)
55
- super
56
- end
57
-
58
- def deprecation_warning(deprecated_method_name, message = nil, caller_backtrace = nil)
59
- caller_backtrace ||= caller_locations(2)
60
- super
61
- end
62
- end
63
- end
64
- end
65
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ActiveSupport
4
- module RubyFeatures # :nodoc:
5
- CLASS_SUBCLASSES = Class.method_defined?(:subclasses) # RUBY_VERSION >= "3.1"
6
- end
7
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- $VERBOSE = true
4
- Warning[:deprecated] = true
5
-
6
- module ActiveSupport
7
- module RaiseWarnings # :nodoc:
8
- PROJECT_ROOT = File.expand_path("../../../../", __dir__)
9
- ALLOWED_WARNINGS = Regexp.union(
10
- /circular require considered harmful.*delayed_job/, # Bug in delayed job.
11
-
12
- # Expected non-verbose warning emitted by Rails.
13
- /Ignoring .*\.yml because it has expired/,
14
- /Failed to validate the schema cache because/,
15
- )
16
-
17
- SUPPRESSED_WARNINGS = Regexp.union(
18
- # TODO: remove if https://github.com/mikel/mail/pull/1557 or similar fix
19
- %r{/lib/mail/parsers/.*statement not reached},
20
- %r{/lib/mail/parsers/.*assigned but unused variable - disp_type_s},
21
- %r{/lib/mail/parsers/.*assigned but unused variable - testEof}
22
- )
23
-
24
- def warn(message, *)
25
- return if SUPPRESSED_WARNINGS.match?(message)
26
-
27
- super
28
-
29
- return unless message.include?(PROJECT_ROOT)
30
- return if ALLOWED_WARNINGS.match?(message)
31
- return unless ENV["RAILS_STRICT_WARNINGS"] || ENV["CI"]
32
-
33
- raise message
34
- end
35
- ruby2_keywords :warn if respond_to?(:ruby2_keywords, true)
36
- end
37
- end
38
-
39
- Warning.singleton_class.prepend(ActiveSupport::RaiseWarnings)