Class: Stupidedi::Schema::Generation::InterchangeGenerator

Inherits:
Object
  • Object
show all
Includes:
Support
Defined in:
lib/stupidedi/schema/generation/interchange_generator.rb

Overview

Generates an interchange (ISA/IEA envelope) file. Detects the component separator from ISA element positions and whether the release supports a repetition separator (I65 in ISA11), and emits replace_separators.

Constant Summary collapse

WORDS =
{
  "0" => "Oh",  "1" => "One", "2" => "Two",   "3" => "Three", "4" => "Four",
  "5" => "Five", "6" => "Six", "7" => "Seven", "8" => "Eight", "9" => "Nine"
}.freeze

Instance Method Summary collapse

Methods included from Support

#namespace, #namespace_path

Constructor Details

#initialize(release, namespace: "Edi") ⇒ InterchangeGenerator

Returns a new instance of InterchangeGenerator.



17
18
19
20
# File 'lib/stupidedi/schema/generation/interchange_generator.rb', line 17

def initialize(release, namespace: "Edi")
  @release = release
  @namespace = namespace
end

Instance Method Details

#generateObject



22
23
24
25
# File 'lib/stupidedi/schema/generation/interchange_generator.rb', line 22

def generate
  validate_release!
  build_ruby_content
end

#output_pathObject



27
28
29
# File 'lib/stupidedi/schema/generation/interchange_generator.rb', line 27

def output_path
  "#{namespace_path}/interchanges/#{interchange_file_name}.rb"
end