zeitwerk 1.4.2 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zeitwerk/loader.rb +20 -8
- 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: 6cb6bd7dd37980b33d67ae3b1a8b5a8228911dd833698617991f6026b06a122c
|
4
|
+
data.tar.gz: 8a9d2438c2008c5c04f21692d1dea9dd0cd7756eb3cd4460262866b1b9eda42f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa2bfe23d1b4c3dde4f6df132c0e6bfb908e540cdc76177cc676fdd7d6843bd6b9af4032978f9948c46c1b74e1979ee592028cafba02fa25f3bdd5eaec0a3d67
|
7
|
+
data.tar.gz: ba5301619afb7d13dd1081330826b06c5bf6a8d520f56aa788423f14fcc2854c70cc9e8d5db7abec9733e05bc7ac3f6e8c7852f4563359abbcc46e5171f96371
|
data/lib/zeitwerk/loader.rb
CHANGED
@@ -227,19 +227,31 @@ module Zeitwerk
|
|
227
227
|
# @return [void]
|
228
228
|
def unload
|
229
229
|
mutex.synchronize do
|
230
|
-
|
230
|
+
# We are going to keep track of the files that were required by our
|
231
|
+
# autoloads to later remove them from $LOADED_FEATURES, thus making them
|
232
|
+
# loadable by Kernel#require again.
|
233
|
+
#
|
234
|
+
# Directories are not stored in $LOADED_FEATURES, keeping track of files
|
235
|
+
# is enough.
|
236
|
+
unloaded_files = Set.new
|
237
|
+
|
238
|
+
autoloads.each do |realpath, (parent, cname)|
|
231
239
|
if parent.autoload?(cname)
|
232
240
|
parent.send(:remove_const, cname)
|
233
241
|
log("autoload for #{cpath(parent, cname)} removed") if logger
|
234
|
-
|
235
|
-
parent
|
236
|
-
|
242
|
+
else
|
243
|
+
if cdef?(parent, cname)
|
244
|
+
parent.send(:remove_const, cname)
|
245
|
+
log("#{cpath(parent, cname)} unloaded") if logger
|
246
|
+
else
|
247
|
+
# Already unloaded somehow, that is fine.
|
248
|
+
end
|
249
|
+
unloaded_files.add(realpath) if ruby?(realpath)
|
237
250
|
end
|
251
|
+
end
|
238
252
|
|
239
|
-
|
240
|
-
|
241
|
-
# array lookups, since directories are not stored in $LOADED_FEATURES.
|
242
|
-
$LOADED_FEATURES.delete(path) if ruby?(path)
|
253
|
+
unless unloaded_files.empty?
|
254
|
+
$LOADED_FEATURES.reject! { |file| unloaded_files.member?(file) }
|
243
255
|
end
|
244
256
|
|
245
257
|
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: 1.4.
|
4
|
+
version: 1.4.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: 2019-03-
|
11
|
+
date: 2019-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
Zeitwerk implements constant autoloading with Ruby semantics. Each gem
|