Ruby zeitwerk: Difference between revisions

From wikinotes
m (Will moved page Ruby zeitworks to Ruby zeitwerk without leaving a redirect)
No edit summary
Line 1: Line 1:
ruby auto import/require module.
ruby auto import/require module.


Used in [[ruby rails]] 6.
Used by default starting in [[ruby rails]] 6.
 
Instead of
<syntaxhighlight lang="ruby">
require "foo/bar/baz"
 
baz = Foo::Bar::Baz.new
</syntaxhighlight>
 
you can just
<syntaxhighlight lang="ruby">
baz = Foo::Bar::Baz.new
</syntaxhighlight>


= Documentation =
= Documentation =
Line 11: Line 23:
|}
|}
</blockquote><!-- documentation -->
</blockquote><!-- documentation -->
= Notes =
<blockquote>
{| class="wikitable"
|-
| [[zeitwerk configuration]]
|-
| [[zeitwerk outside of rails]]
|-
|}
</blockquote><!-- Notes -->

Revision as of 01:18, 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