zeitwerk 2.6.14 → 2.6.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -6
- data/lib/zeitwerk/loader/eager_load.rb +1 -3
- data/lib/zeitwerk/loader/helpers.rb +15 -6
- 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: 8177bcca0fd5895bbe28b19dc5fd04a810e2905f21f33924786a33a317c96207
|
4
|
+
data.tar.gz: 7e441521285fe28230dadfb4c5c9d40564e376dd651ddae043190c5fdd3ee526
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57e0e401c952a13d1b96a8993bbee930132f2b63252ff7cd6646ceeeb5a3de886d1c36a8cdbc06e9add3e16e76bacd08cc8e32b58289fa01e9eabea4dad25581
|
7
|
+
data.tar.gz: e56116c8325ab38f751b8497f8270544543e950f92624c755b5d3d7bb296b48ce4afa668e1b4daae546561ddfa344fd9c650c7114c9cd2c637a514f0ebd38c98
|
data/README.md
CHANGED
@@ -1336,13 +1336,14 @@ This method does not parse file contents and does not guarantee files define the
|
|
1336
1336
|
<a id="markdown-zeitwerkloaderall_expected_cpaths" name="zeitwerkloaderall_expected_cpaths"></a>
|
1337
1337
|
#### `Zeitwerk::Loader#all_expected_cpaths`
|
1338
1338
|
|
1339
|
-
The method `Zeitwerk::Loader#all_expected_cpaths` returns a hash that maps the absolute paths of the files and directories managed by the receiver to their
|
1339
|
+
The method `Zeitwerk::Loader#all_expected_cpaths` returns a hash that maps the absolute paths of the files and directories managed by the receiver to their expected constant paths.
|
1340
1340
|
|
1341
|
-
Ignored files
|
1341
|
+
Ignored files, hidden files, and files whose extension is not ".rb" are not included in the result. Same for directories, hidden or ignored directories are not included in the result. Additionally, directories that contain no files with extension ".rb" (recursively) are also excluded, since those are not considered to represent Ruby namespaces.
|
1342
1342
|
|
1343
1343
|
For example, if `lib` is the root directory of a gem with the following contents:
|
1344
1344
|
|
1345
1345
|
```
|
1346
|
+
lib/.DS_Store
|
1346
1347
|
lib/my_gem.rb
|
1347
1348
|
lib/my_gem/version.rb
|
1348
1349
|
lib/my_gem/ignored.rb
|
@@ -1368,15 +1369,15 @@ lib/tasks/my_gem.rake
|
|
1368
1369
|
}
|
1369
1370
|
```
|
1370
1371
|
|
1371
|
-
|
1372
|
+
In the previous example we assume `lib/my_gem/ignored.rb` is ignored, and therefore it is not present in the returned hash. Also, `lib/my_gem/collapsed` is a collapsed directory, so the expected namespace at that level is still `MyGem` (this is an edge case).
|
1372
1373
|
|
1373
|
-
|
1374
|
+
The file `lib/.DS_Store` is hidden, hence excluded. The directory `lib/tasks` is also not present because it contains no files with extension ".rb".
|
1374
1375
|
|
1375
|
-
|
1376
|
+
Directory paths do not have trailing slashes.
|
1376
1377
|
|
1377
1378
|
The order of the hash entries is undefined.
|
1378
1379
|
|
1379
|
-
This method does not parse file contents and does not guarantee files define the corresponding constant paths. It just says which are the _expected_ ones.
|
1380
|
+
This method does not parse or execute file contents and does not guarantee files define the corresponding constant paths. It just says which are the _expected_ ones.
|
1380
1381
|
|
1381
1382
|
<a id="markdown-encodings" name="encodings"></a>
|
1382
1383
|
### Encodings
|
@@ -209,9 +209,7 @@ module Zeitwerk::Loader::EagerLoad
|
|
209
209
|
next_dirs = []
|
210
210
|
|
211
211
|
suffix.split("::").each do |segment|
|
212
|
-
|
213
|
-
dir = dirs.shift
|
214
|
-
|
212
|
+
while (dir = dirs.shift)
|
215
213
|
ls(dir) do |basename, abspath, ftype|
|
216
214
|
next unless ftype == :directory
|
217
215
|
|
@@ -43,18 +43,27 @@ module Zeitwerk::Loader::Helpers
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
+
# Looks for a Ruby file using breadth-first search. This type of search is
|
47
|
+
# important to list as less directories as possible and return fast in the
|
48
|
+
# common case in which there are Ruby files.
|
49
|
+
#
|
46
50
|
# @sig (String) -> bool
|
47
51
|
private def has_at_least_one_ruby_file?(dir)
|
48
52
|
to_visit = [dir]
|
49
53
|
|
50
|
-
|
51
|
-
|
54
|
+
while (dir = to_visit.shift)
|
55
|
+
children = Dir.children(dir)
|
56
|
+
|
57
|
+
children.each do |basename|
|
58
|
+
next if hidden?(basename)
|
59
|
+
|
60
|
+
abspath = File.join(dir, basename)
|
61
|
+
next if ignored_path?(abspath)
|
52
62
|
|
53
|
-
|
54
|
-
|
55
|
-
return true
|
63
|
+
if dir?(abspath)
|
64
|
+
to_visit << abspath unless roots.key?(abspath)
|
56
65
|
else
|
57
|
-
|
66
|
+
return true if ruby?(abspath)
|
58
67
|
end
|
59
68
|
end
|
60
69
|
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.6.
|
4
|
+
version: 2.6.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xavier Noria
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
Zeitwerk implements constant autoloading with Ruby semantics. Each gem
|