|
1 | 1 | # frozen_string_literal: true
|
2 | 2 |
|
3 | 3 | require "set"
|
4 |
| -require "active_support/core_ext/module/attribute_accessors" |
5 | 4 | require "active_support/dependencies/interlock"
|
6 | 5 |
|
7 | 6 | module ActiveSupport # :nodoc:
|
8 | 7 | module Dependencies # :nodoc:
|
9 | 8 | require_relative "dependencies/require_dependency"
|
10 | 9 |
|
11 |
| - mattr_accessor :interlock, default: Interlock.new |
| 10 | + singleton_class.attr_accessor :interlock |
| 11 | + @interlock = Interlock.new |
12 | 12 |
|
13 | 13 | # :doc:
|
14 | 14 |
|
@@ -40,29 +40,33 @@ def self.unload_interlock
|
40 | 40 | #
|
41 | 41 | # This collection is allowed to have intersection with autoload_once_paths.
|
42 | 42 | # Common directories are not reloaded.
|
43 |
| - mattr_accessor :autoload_paths, default: [] |
| 43 | + singleton_class.attr_accessor :autoload_paths |
| 44 | + self.autoload_paths = [] |
44 | 45 |
|
45 | 46 | # The array of directories from which we autoload and never reload, even if
|
46 | 47 | # reloading is enabled. The public interface to push directories to this
|
47 | 48 | # collection from applications or engines is config.autoload_once_paths.
|
48 |
| - mattr_accessor :autoload_once_paths, default: [] |
| 49 | + singleton_class.attr_accessor :autoload_once_paths |
| 50 | + self.autoload_once_paths = [] |
49 | 51 |
|
50 | 52 | # This is a private set that collects all eager load paths during bootstrap.
|
51 | 53 | # Useful for Zeitwerk integration. The public interface to push custom
|
52 | 54 | # directories to this collection from applications or engines is
|
53 | 55 | # config.eager_load_paths.
|
54 |
| - mattr_accessor :_eager_load_paths, default: Set.new |
| 56 | + singleton_class.attr_accessor :_eager_load_paths |
| 57 | + self._eager_load_paths = Set.new |
55 | 58 |
|
56 | 59 | # If reloading is enabled, this private set holds autoloaded classes tracked
|
57 | 60 | # by the descendants tracker. It is populated by an on_load callback in the
|
58 | 61 | # main autoloader. Used to clear state.
|
59 |
| - mattr_accessor :_autoloaded_tracked_classes, default: Set.new |
| 62 | + singleton_class.attr_accessor :_autoloaded_tracked_classes |
| 63 | + self._autoloaded_tracked_classes = Set.new |
60 | 64 |
|
61 | 65 | # If reloading is enabled, this private attribute stores the main autoloader
|
62 | 66 | # of a Rails application. It is `nil` otherwise.
|
63 | 67 | #
|
64 | 68 | # The public interface for this autoloader is `Rails.autoloaders.main`.
|
65 |
| - mattr_accessor :autoloader |
| 69 | + singleton_class.attr_accessor :autoloader |
66 | 70 |
|
67 | 71 | # Private method that reloads constants autoloaded by the main autoloader.
|
68 | 72 | #
|
|
0 commit comments