Ruby zeitwerk: Difference between revisions
From wikinotes
No edit summary |
No edit summary |
||
Line 3: | Line 3: | ||
<syntaxhighlight lang="ruby"> | <syntaxhighlight lang="ruby"> | ||
# Instead of | # Instead of | ||
require "foo/bar/baz" | require "foo/bar/baz" | ||
baz = Foo::Bar::Baz.new | baz = Foo::Bar::Baz.new | ||
# You can just | # You can just | ||
baz = Foo::Bar::Baz.new | baz = Foo::Bar::Baz.new | ||
</syntaxhighlight> | </syntaxhighlight> |
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