Class: Stupidedi::Config::FunctionalGroupConfig

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Inspect
Defined in:
lib/stupidedi/config/functional_group_config.rb

Overview

The functional group segments (GS/GE) and the segments contained by that functional group are versioned separately from the interchange control segments (ISA/ISE). The functional group version is informally referred to as the EDI version (5010, 4010, etc). Each version indicates the segment dictionary being used and the grammar of the functional group. Only the GS and GE segments are described in the HIPAA guides, but the functional group header and footer may consist of other segments.

Because the interchange and functional group are versioned independently, it may be possible, for instance, to send a 4010 transaction set within a 5010 envelope, depending on forward- and backward-comatibility.

Instance Method Summary collapse

Methods included from Inspect

#inspect

Constructor Details

#initializeFunctionalGroupConfig

Returns a new instance of FunctionalGroupConfig.



25
26
27
# File 'lib/stupidedi/config/functional_group_config.rb', line 25

def initialize
  @table = Hash.new
end

Instance Method Details

#at(version) ⇒ FunctionalGroupDef

Returns:

  • (FunctionalGroupDef)


41
42
43
44
# File 'lib/stupidedi/config/functional_group_config.rb', line 41

def at(version)
  x = @table[version]
  x.is_a?(Proc) ? x.call : x
end

#pretty_print(q) ⇒ void

This method returns an undefined value.



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/stupidedi/config/functional_group_config.rb', line 47

def pretty_print(q)
  q.text "FunctionalGroupConfig"
  q.group(2, "(", ")") do
    q.breakable ""
    @table.keys.each do |e|
      unless q.current_group.first?
        q.text ","
        q.breakable
      end
      q.pp e
    end
  end
end

#register(version, definition = nil, &constructor) ⇒ void

This method returns an undefined value.



32
33
34
35
36
37
38
# File 'lib/stupidedi/config/functional_group_config.rb', line 32

def register(version, definition = nil, &constructor)
  if block_given?
    @table[version] = constructor
  else
    @table[version] = definition
  end
end