zeitwerk 2.7.3 → 2.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1500c4f54c6ac7e64eef74c8702682764fa845533a5b16c67a48ee11781ef3e0
4
- data.tar.gz: f7201576b8b59ab3786cd4bc6fd58f3cd3afa3d8dcc1e86477121000f06ac50a
3
+ metadata.gz: c652e42a3b3a3a92704f1924bac194dc9b9c2db94641e6a9a3daf192480e7c7e
4
+ data.tar.gz: f24017f36733460e4c09ebc7d31de8ee95efda8c7e4f6aede34d4824f4922c3f
5
5
  SHA512:
6
- metadata.gz: ab113d90c9a42ec5c75c6ebe68ab5a04395f1b33228de42de6952f2e673a329f30de85477977ec11d582df82f40c4dc5c08e8ba2305f46a6d07ac4e88c564887
7
- data.tar.gz: 73fb9dc78a9a7148119b306f93a513f841e4888d421fbf178963bbfa1368a8c7c66cd8661a28e8d95d14f51dab16fb4ff886f23183ec13a74847c45c1850f30d
6
+ metadata.gz: d1a853bd6e7b638dc60203e6ba515646260913925ff8d30aa7edcb817253e61a534beadca02159ee7dffa78204d5c0dff652a056d2be2d688b9ec52fc1f9ac91
7
+ data.tar.gz: 26824d767e2f18ef128b66b2b354a6fc7bc16754734eb27bc3c6bf20c8a3ed36a06e2d20c1cbed6b932a327cbb70f4aa58cedd88ed81bf3f8074ebdf90a52e27
data/README.md CHANGED
@@ -201,7 +201,7 @@ For example, given
201
201
 
202
202
  ```ruby
203
203
  loader.push_dir("#{__dir__}/models")
204
- loader.push_dir("#{__dir__}/serializers"))
204
+ loader.push_dir("#{__dir__}/serializers")
205
205
  ```
206
206
 
207
207
  these are the expected classes and modules being defined by these files:
@@ -1334,7 +1334,7 @@ lib/tasks/my_gem.rake
1334
1334
  "/.../lib/my_gem/drivers" => "MyGem::Drivers",
1335
1335
  "/.../lib/my_gem/drivers/unix.rb" => "MyGem::Drivers::Unix",
1336
1336
  "/.../lib/my_gem/drivers/windows.rb" => "MyGem::Drivers::Windows",
1337
- "/.../lib/my_gem/collapsed" => "MyGem"
1337
+ "/.../lib/my_gem/collapsed" => "MyGem",
1338
1338
  "/.../lib/my_gem/collapsed/foo.rb" => "MyGem::Foo"
1339
1339
  }
1340
1340
  ```
@@ -17,7 +17,7 @@
17
17
  # For example, if we store values 0, 1, and 2 for the crefs that would
18
18
  # correspond to `M::X`, `M::Y`, and `N::Z`, the map will look like this:
19
19
  #
20
- # { M => { X: 0, :Y => 1 }, N => { Z: 2 } }
20
+ # { M => { X: 0, Y: 1 }, N => { Z: 2 } }
21
21
  #
22
22
  # This structure is internal, so only the needed interface is implemented.
23
23
  #
@@ -44,7 +44,7 @@
44
44
  #
45
45
  # as hash code instead.
46
46
  #
47
- # Benchamrks
47
+ # Benchmarks
48
48
  # ----------
49
49
  #
50
50
  # Writing:
@@ -44,9 +44,9 @@ module Zeitwerk
44
44
  # file is normally required and, while doing so, the loader sets an autoload
45
45
  # on the gem namespace. That autoload hits this edge case.
46
46
  #
47
- # There is some logic that neeeds to know if an autoload for a given
48
- # constant already exists. We check Module#autoload? first, and fallback to
49
- # the inceptions just in case.
47
+ # There is some logic that needs to know if an autoload for a given constant
48
+ # already exists. We check Module#autoload? first, and fallback to the
49
+ # inceptions just in case.
50
50
  #
51
51
  # This map keeps track of pairs (cref, autoload_path) found by the loader.
52
52
  # The object Zeitwerk::Registry.inceptions, on the other hand, acts as a
@@ -199,7 +199,7 @@ module Zeitwerk
199
199
  # To make it aware of changes, the gem defines singleton methods in
200
200
  # $LOADED_FEATURES:
201
201
  #
202
- # https://github.com/Shopify/bootsnap/blob/master/lib/bootsnap/load_path_cache/core_ext/loaded_features.rb
202
+ # https://github.com/Shopify/bootsnap/blob/main/lib/bootsnap/load_path_cache/core_ext/loaded_features.rb
203
203
  #
204
204
  # Rails applications may depend on bootsnap, so for unloading to work
205
205
  # in that setting it is preferable that we restrict our API choice to
@@ -597,22 +597,24 @@ module Zeitwerk
597
597
  #: (String) -> void
598
598
  private def raise_if_conflicting_directory(dir)
599
599
  MUTEX.synchronize do
600
- dir_slash = dir + "/"
601
-
602
600
  Registry.loaders.each do |loader|
603
601
  next if loader == self
604
- next if loader.__ignores?(dir)
605
602
 
606
603
  loader.__roots.each_key do |root_dir|
607
- next if ignores?(root_dir)
604
+ # Conflicting directories are rare, optimize for the common case.
605
+ next if !dir.start_with?(root_dir) && !root_dir.start_with?(dir)
608
606
 
607
+ dir_slash = dir + "/"
609
608
  root_dir_slash = root_dir + "/"
610
- if dir_slash.start_with?(root_dir_slash) || root_dir_slash.start_with?(dir_slash)
611
- require "pp" # Needed for pretty_inspect, even in Ruby 2.5.
612
- raise Error,
613
- "loader\n\n#{pretty_inspect}\n\nwants to manage directory #{dir}," \
614
- " which is already managed by\n\n#{loader.pretty_inspect}\n"
615
- end
609
+ next if !dir_slash.start_with?(root_dir_slash) && !root_dir_slash.start_with?(dir_slash)
610
+
611
+ next if ignores?(root_dir)
612
+ break if loader.__ignores?(dir)
613
+
614
+ require "pp" # Needed to have pretty_inspect available.
615
+ raise Error,
616
+ "loader\n\n#{pretty_inspect}\n\nwants to manage directory #{dir}," \
617
+ " which is already managed by\n\n#{loader.pretty_inspect}\n"
616
618
  end
617
619
  end
618
620
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Zeitwerk
4
4
  #: String
5
- VERSION = "2.7.3"
5
+ VERSION = "2.7.4"
6
6
  end
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zeitwerk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.3
4
+ version: 2.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xavier Noria
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2025-12-16 00:00:00.000000000 Z
11
12
  dependencies: []
12
13
  description: |2
13
14
  Zeitwerk implements constant autoloading with Ruby semantics. Each gem
@@ -49,9 +50,10 @@ licenses:
49
50
  - MIT
50
51
  metadata:
51
52
  homepage_uri: https://github.com/fxn/zeitwerk
52
- changelog_uri: https://github.com/fxn/zeitwerk/blob/master/CHANGELOG.md
53
+ changelog_uri: https://github.com/fxn/zeitwerk/blob/main/CHANGELOG.md
53
54
  source_code_uri: https://github.com/fxn/zeitwerk
54
55
  bug_tracker_uri: https://github.com/fxn/zeitwerk/issues
56
+ post_install_message:
55
57
  rdoc_options: []
56
58
  require_paths:
57
59
  - lib
@@ -66,7 +68,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
68
  - !ruby/object:Gem::Version
67
69
  version: '0'
68
70
  requirements: []
69
- rubygems_version: 3.6.9
71
+ rubygems_version: 3.4.19
72
+ signing_key:
70
73
  specification_version: 4
71
74
  summary: Efficient and thread-safe constant autoloader
72
75
  test_files: []