Ruby zeitwerk: Difference between revisions
From wikinotes
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
Used by default starting in [[ruby rails]] 6. | Used by default starting in [[ruby rails]] 6. | ||
<syntaxhighlight lang="ruby"> | <syntaxhighlight lang="ruby"> | ||
# Instead of: | |||
require "foo/bar/baz" | require "foo/bar/baz" | ||
baz = Foo::Bar::Baz.new | baz = Foo::Bar::Baz.new | ||
# You can just: | |||
baz = Foo::Bar::Baz.new | baz = Foo::Bar::Baz.new | ||
</syntaxhighlight> | </syntaxhighlight> | ||
= Documentation = | = Documentation = |
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