Class: Stupidedi::Schema::Generation::RegistrationGenerator
- Inherits:
-
Object
- Object
- Stupidedi::Schema::Generation::RegistrationGenerator
- Includes:
- Support
- Defined in:
- lib/stupidedi/schema/generation/registration_generator.rb
Overview
Generates stupidedi_registration.rb. Does not read X12 data - instead it scans already-generated files and emits a register(config) method plus INTERCHANGE_VERSIONS / FUNCTIONAL_GROUP_VERSIONS constants.
The registration is a whole-tree artifact: it must list every release present in the output tree, not just one. It therefore scans an ordered list of roots and unions the releases it finds. Earlier roots shadow later ones per release, so a run can scan [staging, out] and aggregate the freshly generated release (in staging) with the releases already committed under out, without listing either twice.
Constant Summary collapse
- WORDS_TO_DIGITS =
{ "Oh" => "0", "One" => "1", "Two" => "2", "Three" => "3", "Four" => "4", "Five" => "5", "Six" => "6", "Seven" => "7", "Eight" => "8", "Nine" => "9" }.freeze
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(roots:, namespace: "Edi") ⇒ RegistrationGenerator
constructor
A new instance of RegistrationGenerator.
- #output_path ⇒ Object
Methods included from Support
Constructor Details
#initialize(roots:, namespace: "Edi") ⇒ RegistrationGenerator
Returns a new instance of RegistrationGenerator.
26 27 28 29 30 31 32 33 34 |
# File 'lib/stupidedi/schema/generation/registration_generator.rb', line 26 def initialize(roots:, namespace: "Edi") @roots = Array(roots) @namespace = namespace @registrations = { interchanges: {}, functional_groups: {}, transaction_sets: {} } end |
Instance Method Details
#generate ⇒ Object
36 37 38 39 |
# File 'lib/stupidedi/schema/generation/registration_generator.rb', line 36 def generate scan_existing_definitions build_ruby_content end |
#output_path ⇒ Object
41 42 43 |
# File 'lib/stupidedi/schema/generation/registration_generator.rb', line 41 def output_path "#{namespace_path}/stupidedi_registration.rb" end |