module Eancom

Constants

DELIMITERS
FILE_TYPES
VERSION

Attributes

definitions[RW]
segments[RW]

Public Class Methods

definitions() click to toggle source
# File lib/eancom.rb, line 30
def self.definitions
  @configs ||= {}
end
find_definition(name:, type:) click to toggle source
# File lib/eancom.rb, line 49
def self.find_definition(name:, type:)
  definitions[type][name]
end
find_segment(tag:) click to toggle source
# File lib/eancom.rb, line 57
def self.find_segment(tag:)
  segments[tag]
end
find_structure(tag:) click to toggle source
# File lib/eancom.rb, line 65
def self.find_structure(tag:)
  structure = structures[tag]
  if structure.nil?
    raise StructureNotFoundError.new(
      "Structure for tag: #{tag} not found."
    )
  end
  structure
end
register_definition(definition) click to toggle source
# File lib/eancom.rb, line 42
def self.register_definition(definition)
  type = definition.type
  name = definition.name
  definitions[type] ||= {}
  definitions[type][name] = definition
end
register_segment(tag:, klass:) click to toggle source
# File lib/eancom.rb, line 53
def self.register_segment(tag:, klass:)
  segments[tag] ||= klass
end
register_structure(tag:, structure:) click to toggle source
# File lib/eancom.rb, line 61
def self.register_structure(tag:, structure:)
  structures[tag] ||= structure
end
segments() click to toggle source
# File lib/eancom.rb, line 34
def self.segments
  @segments ||= {}
end
structures() click to toggle source
# File lib/eancom.rb, line 38
def self.structures
  @structures ||= {}
end