Class: Generator::IntrospectionLoader
- Inherits:
-
Object
- Object
- Generator::IntrospectionLoader
- Defined in:
- lib/generator/support/introspection_loader.rb
Overview
Provides a temporary Zeitwerk loader for introspecting generated files during RBS generation. This loader is separate from the main gem loader and is only used during code generation.
Class Method Summary collapse
-
.reload ⇒ Object
Reloads all files (call this after generating new files).
-
.setup ⇒ Object
Sets up and returns a configured Zeitwerk loader for introspection.
Class Method Details
.reload ⇒ Object
Reloads all files (call this after generating new files)
29 30 31 |
# File 'lib/generator/support/introspection_loader.rb', line 29 def reload @loader&.reload end |
.setup ⇒ Object
Sets up and returns a configured Zeitwerk loader for introspection
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/generator/support/introspection_loader.rb', line 12 def setup return @loader if @loader lib_dir = File.("../../../lib", __dir__ || raise) root_file = File.join(lib_dir, "peddler.rb") @loader = Zeitwerk::Loader.new @loader.push_dir(lib_dir) @loader.inflector = Peddler::Inflector.new(root_file) @loader.ignore("#{lib_dir}/generator") @loader.enable_reloading @loader.setup @loader end |