lib/rubysmith/templates/%project_name%/lib/%project_path%.rb.erb in rubysmith-5.8.0 vs lib/rubysmith/templates/%project_name%/lib/%project_path%.rb.erb in rubysmith-5.8.1
- old
+ new
@@ -14,10 +14,18 @@
end
<% end %>
<% end %>
<% if configuration.build_zeitwerk %>
<% namespace do %>
- def self.loader(registry = Zeitwerk::Registry) = registry.loader_for __FILE__
+ <% if configuration.project_levels.positive? %>
+ def self.loader registry = Zeitwerk::Registry
+ @loader ||= registry.loaders.find { |loader| loader.tag == "<%= configuration.project_name %>" }
+ end
+ <% else %>
+ def self.loader registry = Zeitwerk::Registry
+ @loader ||= registry.loaders.find { |loader| loader.tag == File.basename(__FILE__, ".rb") }
+ end
+ <% end %>
<% end %>
<% else %>
<% namespace %>
<% end %>