Class: Stupidedi::Schema::Generation::SegmentGenerator
- Inherits:
-
Object
- Object
- Stupidedi::Schema::Generation::SegmentGenerator
- Includes:
- Support
- Defined in:
- lib/stupidedi/schema/generation/segment_generator.rb
Overview
Generates segment_defs.rb for a release: every segment definition with its ordered element uses and syntax notes. With include_control_segments: true it also emits ISA/IEA/GS/GE/TA1.
Constant Summary collapse
- SYNTAX_NOTE_MAP =
{ "paired" => "P", "required" => "R", "conditional" => "C", "excluded" => "E", "list_conditional" => "L" }.freeze
- CONTROL_SEGMENTS =
Interchange control segments - included when include_control_segments: true
%w[ISA IEA GS GE TA1].freeze
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(release, include_control_segments: false, namespace: "Edi") ⇒ SegmentGenerator
constructor
A new instance of SegmentGenerator.
- #output_path ⇒ Object
Methods included from Support
Constructor Details
#initialize(release, include_control_segments: false, namespace: "Edi") ⇒ SegmentGenerator
Returns a new instance of SegmentGenerator.
23 24 25 26 27 |
# File 'lib/stupidedi/schema/generation/segment_generator.rb', line 23 def initialize(release, include_control_segments: false, namespace: "Edi") @release = release @include_control_segments = include_control_segments @namespace = namespace end |
Instance Method Details
#generate ⇒ Object
29 30 31 32 |
# File 'lib/stupidedi/schema/generation/segment_generator.rb', line 29 def generate validate_release! build_ruby_content end |
#output_path ⇒ Object
34 35 36 |
# File 'lib/stupidedi/schema/generation/segment_generator.rb', line 34 def output_path "#{namespace_path}/#{underscore(version_module)}/segment_defs.rb" end |