zeitwerk 2.5.3 → 2.5.4
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/README.md +1 -1
- data/lib/zeitwerk/kernel.rb +5 -5
- data/lib/zeitwerk/loader.rb +7 -1
- data/lib/zeitwerk/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3640f4751b86923c0dc81be1aed0580b1e2bdef59c6d3cc06c0c736d03b78c3b
|
4
|
+
data.tar.gz: 262a7697cfca8fa8d9630687ba8439dd9df404c052b71e5b91fb498c4114e5db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7decde169af7a300ae8962339a8886cede3cfdd75ade4d7428c39a53f3dad96c194b7e938938811dce8208f70dfcf2cc29735c03384eaa776dbc2985fea87325
|
7
|
+
data.tar.gz: 99c16812c1ad437860029642af2d1c1ffc00962369aa1f6dc770b1f64d102b09f046c3ad3ae2dc44d50479314a14b8c9ddb2d446a619407ca05178aff43890de
|
data/README.md
CHANGED
@@ -437,7 +437,7 @@ However, that can be overridden with `force`:
|
|
437
437
|
loader.eager_load(force: true) # database adapters are eager loaded
|
438
438
|
```
|
439
439
|
|
440
|
-
Which may be handy if the project eager loads in the test suite to [ensure project
|
440
|
+
Which may be handy if the project eager loads in the test suite to [ensure project layout compliance](#testing-compliance).
|
441
441
|
|
442
442
|
The `force` flag does not affect ignored files and directories, those are still ignored.
|
443
443
|
|
data/lib/zeitwerk/kernel.rb
CHANGED
@@ -3,11 +3,11 @@
|
|
3
3
|
module Kernel
|
4
4
|
module_function
|
5
5
|
|
6
|
-
#
|
6
|
+
# Zeitwerk's main idea is to define autoloads for project constants, and then
|
7
|
+
# intercept them when triggered in this thin `Kernel#require` wrapper.
|
7
8
|
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# managed files are loaded.
|
9
|
+
# That allows us to complete the circle, invoke callbacks, autovivify modules,
|
10
|
+
# define autoloads for just autoloaded namespaces, update internal state, etc.
|
11
11
|
#
|
12
12
|
# On the other hand, if you publish a new version of a gem that is now managed
|
13
13
|
# by Zeitwerk, client code can reference directly your classes and modules and
|
@@ -17,7 +17,7 @@ module Kernel
|
|
17
17
|
#
|
18
18
|
# We cannot decorate with prepend + super because Kernel has already been
|
19
19
|
# included in Object, and changes in ancestors don't get propagated into
|
20
|
-
# already existing ancestor chains.
|
20
|
+
# already existing ancestor chains on Ruby < 3.0.
|
21
21
|
alias_method :zeitwerk_original_require, :require
|
22
22
|
|
23
23
|
# @sig (String) -> true | false
|
data/lib/zeitwerk/loader.rb
CHANGED
@@ -144,7 +144,13 @@ module Zeitwerk
|
|
144
144
|
end
|
145
145
|
|
146
146
|
to_unload.each do |cpath, (abspath, (parent, cname))|
|
147
|
-
|
147
|
+
# We have to check cdef? in this condition. Reason is, constants whose
|
148
|
+
# file does not define them have to be kept in to_unload as explained
|
149
|
+
# in the implementation of on_file_autoloaded.
|
150
|
+
#
|
151
|
+
# If the constant is not defined, on_unload should not be triggered
|
152
|
+
# for it.
|
153
|
+
if !on_unload_callbacks.empty? && cdef?(parent, cname)
|
148
154
|
value = parent.const_get(cname)
|
149
155
|
run_on_unload_callbacks(cpath, value, abspath)
|
150
156
|
end
|
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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xavier Noria
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
Zeitwerk implements constant autoloading with Ruby semantics. Each gem
|
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '0'
|
60
60
|
requirements: []
|
61
|
-
rubygems_version: 3.
|
61
|
+
rubygems_version: 3.3.3
|
62
62
|
signing_key:
|
63
63
|
specification_version: 4
|
64
64
|
summary: Efficient and thread-safe constant autoloader
|