zeitwerk 2.5.3 → 2.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e0d44c224600274a41893cc27d119539f5d625c3be6ed46a54052d9b139c58c
4
- data.tar.gz: 16c701ed5717318fab08631a001a7c067f81a2027fabbfe4b6a0f6775da60a7d
3
+ metadata.gz: 3640f4751b86923c0dc81be1aed0580b1e2bdef59c6d3cc06c0c736d03b78c3b
4
+ data.tar.gz: 262a7697cfca8fa8d9630687ba8439dd9df404c052b71e5b91fb498c4114e5db
5
5
  SHA512:
6
- metadata.gz: d897fb5bdfc8b27080dbcd6160945e4a4cec6fb0f31c4eb21cd448ec26d1291ad373696995aaddcf4e387b7d731fbe4530b43f3b77f97159ba69bed447f07ade
7
- data.tar.gz: 3cc2dbbc0840f2d420eb32ed725aaf24b7d889d989060211a9877703b44b6e71fa1d1884df2f50cfbf121b1954cf51db7e867232cde7470698fdb7e408c1be23
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 layour compliance](#testing-compliance).
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
 
@@ -3,11 +3,11 @@
3
3
  module Kernel
4
4
  module_function
5
5
 
6
- # We are going to decorate Kernel#require with two goals.
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
- # First, by intercepting Kernel#require calls, we are able to autovivify
9
- # modules on required directories, and also do internal housekeeping when
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
@@ -144,7 +144,13 @@ module Zeitwerk
144
144
  end
145
145
 
146
146
  to_unload.each do |cpath, (abspath, (parent, cname))|
147
- unless on_unload_callbacks.empty?
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Zeitwerk
4
- VERSION = "2.5.3"
4
+ VERSION = "2.5.4"
5
5
  end
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.3
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: 2021-12-30 00:00:00.000000000 Z
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.2.22
61
+ rubygems_version: 3.3.3
62
62
  signing_key:
63
63
  specification_version: 4
64
64
  summary: Efficient and thread-safe constant autoloader