zeitwerk 2.8.0 → 2.8.1

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: 071170ec551e69be67c517af6e04ae2788d6f81f6451a7da0dfab49be8f0c52b
4
- data.tar.gz: 96fd655043bee86c5f57567a01b5f5282e315b72bde7e5ca370ee8fd5e7917fb
3
+ metadata.gz: f6f3971296735d2ad5ae2d2621b5f26d6f480e7b69fde7e6eb21679a2b0c795c
4
+ data.tar.gz: 41ce43ff32412f63d21fb5bd9f45dc070e48e96f03be1e49eb2a5c6c5ef107ba
5
5
  SHA512:
6
- metadata.gz: 2b74298014af2753fbb19ad36f2a5d484cfbe364beb6aa583fe43d1f2cdf2fc3135bd5aaa16bedeb45a4a4ecbae95fc9d2e62aae5b59fd3df7cf5422693a947f
7
- data.tar.gz: 242710104b8d2fba905cb65d1382080d098f4ff6c3d8b982d1cf53e9ea877612b22ee07b9d3f8f155a17b354e8412f2f350d835e7418f6eef7cf33a324a5ea4a
6
+ metadata.gz: 2b543e2a0db16c3dcdf8318faeaae7e1a72b0001b6116fa0081fa991266fbcc75da8ebdecaf9cf17568d9b169688810f411fb5d578a6ce7f5fad60a5fea37380
7
+ data.tar.gz: 021343c474a12a015071b20eaff22c53fdf9d0a49e606ee460be809fd731be065e72573ffb082bfab19b14f432000b309cc3e8e44e75669b97d91fa5b275519a
data/README.md CHANGED
@@ -305,8 +305,8 @@ loader.nsfile = 'ns.rb' # must be set before setup
305
305
  you can alternatively define the explicit namespace inside its directory:
306
306
 
307
307
  ```
308
- my_component/ns.rb # MyComponent
309
- my_component/widget.rb # MyComponent::Widget
308
+ my_component/ns.rb -> MyComponent
309
+ my_component/widget.rb -> MyComponent::Widget
310
310
  ```
311
311
 
312
312
  This may be handy for self-contained units for which a `my_component.rb` file in the parent directory would feel unnatural.
@@ -316,19 +316,19 @@ A loader's nsfile has to be a non-hidden basename with a `.rb` extension, as in
316
316
  Collapsed directories work as expected. For example, if we assume that `src` is collapsed, and that `assets` and `tests` are ignored, you could have the code organized this way:
317
317
 
318
318
  ```
319
- my_component/src/ns.rb # MyComponent
320
- my_component/src/widget.rb # MyComponent::Widget
319
+ my_component/src/ns.rb -> MyComponent
320
+ my_component/src/widget.rb -> MyComponent::Widget
321
321
  my_component/assets/widget.js
322
322
  my_component/tests/test_widget.rb
323
323
  ```
324
324
 
325
- Loaders with an nsfile configured also support explicit namespaces defined in ordinary files. The styles are not exclusive. Some parts of the project may be component-oriented, while in other parts ordinary files may feel more natural. That works.
325
+ Loaders with an nsfile configured also support explicit namespaces defined in ordinary files. The conventions are not exclusive project-wide. Some parts may be component-oriented, while in other parts ordinary files may feel more natural. That works.
326
326
 
327
327
  However, attempting to define the same namespace using an ordinary file and an nsfile is an error condition that raises `Zeitwerk::ConflictingNamespaceDefinitionError`.
328
328
 
329
329
  Nsfiles in root directories raise `Zeitwerk::ConflictingNamespaceDefinitionError` too, since the namespace in a root directory is externally defined.
330
330
 
331
- A project file whose basename is equal to the nsfile is always considered to be an nsfile. You cannot opt out. Therefore, if we have:
331
+ Non-ignored files whose basename is equal to the nsfile are always considered to be nsfiles. You cannot opt out. Therefore, if we have:
332
332
 
333
333
  ```ruby
334
334
  loader.nsfile = 'index.rb'
@@ -336,12 +336,6 @@ loader.nsfile = 'index.rb'
336
336
 
337
337
  there is no way `foo/index.rb` can define `Foo::Index` in any part of the project, it must define `Foo`.
338
338
 
339
- While configurable, `ns.rb` is the recommended convention:
340
-
341
- * `ns.rb` is short.
342
- * `ns.rb` suggests "namespace".
343
- * Needing an `Ns` constant is unlikely.
344
-
345
339
  <a id="markdown-collapsing-directories" name="collapsing-directories"></a>
346
340
  ### Collapsing directories
347
341
 
@@ -27,7 +27,7 @@ class Zeitwerk::Loader::FileSystem # :nodoc:
27
27
  # path, and file type, which can only be :file or :directory.
28
28
  #
29
29
  #: (String) { (String, String, Symbol) -> void } -> void
30
- def ls(dir, collapse: true, &)
30
+ def ls(dir, collapse: true, &block)
31
31
  children = relevant_dir_entries(dir)
32
32
 
33
33
  # The order in which a directory is listed depends on the file system.
@@ -43,7 +43,7 @@ class Zeitwerk::Loader::FileSystem # :nodoc:
43
43
  @loader.__log { "directory #{abspath} is ignored because it has no Ruby files" }
44
44
  next
45
45
  elsif collapse && @loader.__collapse?(abspath)
46
- ls(abspath, collapse: collapse, &)
46
+ ls(abspath, collapse: collapse, &block)
47
47
  next
48
48
  end
49
49
  end
@@ -6,8 +6,8 @@ module Zeitwerk::Registry
6
6
  end
7
7
 
8
8
  #: ({ (Zeitwerk::Loader) -> void }) -> void
9
- def each(&)
10
- @loaders.each(&)
9
+ def each(&block)
10
+ @loaders.each(&block)
11
11
  end
12
12
 
13
13
  #: (Zeitwerk::Loader) -> void
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Zeitwerk
4
4
  #: String
5
- VERSION = '2.8.0'
5
+ VERSION = '2.8.1'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zeitwerk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.0
4
+ version: 2.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Xavier Noria