Class: Stupidedi::Schema::Generation::MasterLoaderGenerator
- Inherits:
-
Object
- Object
- Stupidedi::Schema::Generation::MasterLoaderGenerator
- Includes:
- Support
- Defined in:
- lib/stupidedi/schema/generation/master_loader_generator.rb
Overview
Generates an optional master loader (e.g. edi.rb) that requires the whole
generated tree in dependency order, so a non-Rails consumer can pull in
the entire grammar with a single require "edi".
Like the registration generator it is a whole-tree artifact: it scans an ordered list of roots and unions the releases found (earlier roots shadow later ones per release), so a run can scan [staging, out] and require the freshly generated release together with releases already under out.
Not emitted by default - it adds a file the Rails-autoloaded layout does not need. Pass master_loader: true (or --master-loader) to include it.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(roots:, namespace: "Edi") ⇒ MasterLoaderGenerator
constructor
A new instance of MasterLoaderGenerator.
- #output_path ⇒ Object
Methods included from Support
Constructor Details
#initialize(roots:, namespace: "Edi") ⇒ MasterLoaderGenerator
Returns a new instance of MasterLoaderGenerator.
21 22 23 24 |
# File 'lib/stupidedi/schema/generation/master_loader_generator.rb', line 21 def initialize(roots:, namespace: "Edi") @roots = Array(roots) @namespace = namespace end |
Instance Method Details
#generate ⇒ Object
26 27 28 |
# File 'lib/stupidedi/schema/generation/master_loader_generator.rb', line 26 def generate build_ruby_content end |
#output_path ⇒ Object
30 31 32 |
# File 'lib/stupidedi/schema/generation/master_loader_generator.rb', line 30 def output_path "#{namespace_path}.rb" end |