zeitwerk 2.5.2 → 2.5.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.
- checksums.yaml +4 -4
- data/lib/zeitwerk/kernel.rb +0 -1
- data/lib/zeitwerk/loader.rb +11 -9
- data/lib/zeitwerk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e0d44c224600274a41893cc27d119539f5d625c3be6ed46a54052d9b139c58c
|
4
|
+
data.tar.gz: 16c701ed5717318fab08631a001a7c067f81a2027fabbfe4b6a0f6775da60a7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d897fb5bdfc8b27080dbcd6160945e4a4cec6fb0f31c4eb21cd448ec26d1291ad373696995aaddcf4e387b7d731fbe4530b43f3b77f97159ba69bed447f07ade
|
7
|
+
data.tar.gz: 3cc2dbbc0840f2d420eb32ed725aaf24b7d889d989060211a9877703b44b6e71fa1d1884df2f50cfbf121b1954cf51db7e867232cde7470698fdb7e408c1be23
|
data/lib/zeitwerk/kernel.rb
CHANGED
data/lib/zeitwerk/loader.rb
CHANGED
@@ -123,7 +123,13 @@ module Zeitwerk
|
|
123
123
|
# @sig () -> void
|
124
124
|
def unload
|
125
125
|
mutex.synchronize do
|
126
|
-
|
126
|
+
# We are going to keep track of the files that were required by our
|
127
|
+
# autoloads to later remove them from $LOADED_FEATURES, thus making them
|
128
|
+
# loadable by Kernel#require again.
|
129
|
+
#
|
130
|
+
# Directories are not stored in $LOADED_FEATURES, keeping track of files
|
131
|
+
# is enough.
|
132
|
+
unloaded_files = Set.new
|
127
133
|
|
128
134
|
autoloads.each do |abspath, (parent, cname)|
|
129
135
|
if parent.autoload?(cname)
|
@@ -133,7 +139,7 @@ module Zeitwerk
|
|
133
139
|
# and the constant path would escape unloadable_cpath? This is just
|
134
140
|
# defensive code to clean things up as much as we are able to.
|
135
141
|
unload_cref(parent, cname)
|
136
|
-
|
142
|
+
unloaded_files.add(abspath) if ruby?(abspath)
|
137
143
|
end
|
138
144
|
end
|
139
145
|
|
@@ -144,14 +150,10 @@ module Zeitwerk
|
|
144
150
|
end
|
145
151
|
|
146
152
|
unload_cref(parent, cname)
|
147
|
-
|
153
|
+
unloaded_files.add(abspath) if ruby?(abspath)
|
148
154
|
end
|
149
155
|
|
150
|
-
unless
|
151
|
-
# We remove these abspaths from $LOADED_FEATURES because, otherwise,
|
152
|
-
# `require`'s idempotence would prevent newly defined autoloads from
|
153
|
-
# loading them again.
|
154
|
-
#
|
156
|
+
unless unloaded_files.empty?
|
155
157
|
# Bootsnap decorates Kernel#require to speed it up using a cache and
|
156
158
|
# this optimization does not check if $LOADED_FEATURES has the file.
|
157
159
|
#
|
@@ -163,7 +165,7 @@ module Zeitwerk
|
|
163
165
|
# Rails applications may depend on bootsnap, so for unloading to work
|
164
166
|
# in that setting it is preferable that we restrict our API choice to
|
165
167
|
# one of those methods.
|
166
|
-
$LOADED_FEATURES.reject! { |file|
|
168
|
+
$LOADED_FEATURES.reject! { |file| unloaded_files.member?(file) }
|
167
169
|
end
|
168
170
|
|
169
171
|
autoloads.clear
|
data/lib/zeitwerk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zeitwerk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xavier Noria
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
Zeitwerk implements constant autoloading with Ruby semantics. Each gem
|