Module: Jets::Autoloaders
- Extended by:
- Memoist
- Defined in:
- lib/jets/autoloaders.rb
Defined Under Namespace
Classes: OnceInflector
Class Method Summary collapse
Class Method Details
.cli ⇒ Object
62 63 64 65 66 67 68 69 70 |
# File 'lib/jets/autoloaders.rb', line 62 def cli Zeitwerk::Loader.new.tap do |loader| loader.tag = "jets.cli" loader.inflector = OnceInflector.new loader.push_dir("#{__dir__}/commands", namespace: Jets::Commands) loader.ignore("#{__dir__}/commands/templates*") end end |
.log! ⇒ Object
23 24 25 26 27 |
# File 'lib/jets/autoloaders.rb', line 23 def log! main.log! once.log! cli.log! end |
.main ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/jets/autoloaders.rb', line 29 def main Zeitwerk::Loader.new.tap do |loader| loader.tag = "jets.main" # loader.inflector = Inflector.new # TODO: allow custom app inflector # The main loader is configured later on in Jets::Application#setup_autoload_paths # because it needs access to Jets.root and Jets.config settings end end |
.once ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/jets/autoloaders.rb', line 39 def once Zeitwerk::Loader.new.tap do |loader| loader.tag = "jets.once" loader.inflector = OnceInflector.new loader.push_dir("#{__dir__}/..") internal_app_paths.each do |path| loader.push_dir("#{__dir__}/#{path}") # Cannot eager load internal app classes because need the app first for classes like ApplicationHelper loader.do_not_eager_load("#{__dir__}/#{path}") end do_not_eager_load_paths.each do |path| loader.do_not_eager_load("#{__dir__}/#{path}") end ignore_paths.each do |path| loader.ignore("#{__dir__}/#{path}") end end end |