Ruby zeitwerk: Difference between revisions

From wikinotes
No edit summary
No edit summary
Line 1: Line 1:
ruby auto import/require module.
ruby auto import/require module.<br>
 
Used by default starting in [[ruby rails]] 6.
Used by default starting in [[ruby rails]] 6.


Example:
<blockquote>
Instead of
Instead of
<syntaxhighlight lang="ruby">
<syntaxhighlight lang="ruby">
Line 14: Line 15:
baz = Foo::Bar::Baz.new
baz = Foo::Bar::Baz.new
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!--  -->


= Documentation =
= Documentation =

Revision as of 01:20, 29 July 2023

ruby auto import/require module.
Used by default starting in ruby rails 6.

Example:

Instead of

require "foo/bar/baz"

baz = Foo::Bar::Baz.new

you can just

baz = Foo::Bar::Baz.new

Documentation

github https://github.com/fxn/zeitwerk

Notes

zeitwerk configuration
zeitwerk outside of rails