Ruby zeitwerk: Difference between revisions
From wikinotes
No edit summary |
No edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
ruby auto import/require module. | ruby auto import/require module.<br> | ||
Used by default starting in [[ruby rails]] 6. | |||
<syntaxhighlight lang="ruby"> | |||
# Instead of | |||
require "foo/bar/baz" | |||
baz = Foo::Bar::Baz.new | |||
# You can just | |||
baz = Foo::Bar::Baz.new | |||
</syntaxhighlight> | |||
= Documentation = | = Documentation = | ||
Line 11: | Line 19: | ||
|} | |} | ||
</blockquote><!-- documentation --> | </blockquote><!-- documentation --> | ||
= Notes = | |||
<blockquote> | |||
{| class="wikitable" | |||
|- | |||
| [[zeitwerk configuration]] | |||
|- | |||
| [[zeitwerk outside of rails]] | |||
|- | |||
|} | |||
</blockquote><!-- Notes --> |
Latest revision as of 01:27, 29 July 2023
ruby auto import/require module.
Used by default starting in ruby rails 6.
# 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