From 821d6c694cd305b7792b96d6ebc1c15ca235cf3e Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Mon, 11 Feb 2019 12:44:25 -0800 Subject: Zeitwerk integration --- railties/lib/rails.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'railties/lib/rails.rb') diff --git a/railties/lib/rails.rb b/railties/lib/rails.rb index 092105d502..bca2cf34e1 100644 --- a/railties/lib/rails.rb +++ b/railties/lib/rails.rb @@ -110,5 +110,25 @@ module Rails def public_path application && Pathname.new(application.paths["public"].first) end + + def autoloader + if configuration.autoloader == :zeitwerk + @autoloader ||= Zeitwerk::Loader.new + end + end + + def once_autoloader + if configuration.autoloader == :zeitwerk + @once_autoloader ||= Zeitwerk::Loader.new + end + end + + def autoloaders + if configuration.autoloader == :zeitwerk + [autoloader, once_autoloader] + else + [] + end + end end end -- cgit v1.2.3