Class: Stupidedi::Config::FunctionalGroupConfig

Inherits:
Object
  • Object
show all
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.



27
28
29
# File 'lib/stupidedi/config/functional_group_config.rb', line 27

def initialize
  @table = Hash.new
end

Instance Method Details

#at(version) ⇒ FunctionalGroupDef

Returns:

  • (FunctionalGroupDef)


45
46
47
48
# File 'lib/stupidedi/config/functional_group_config.rb', line 45

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

#customize(&block) ⇒ Object



31
32
33
# File 'lib/stupidedi/config/functional_group_config.rb', line 31

def customize(&block)
  tap(&block)
end

#pretty_print(q) ⇒ void

This method returns an undefined value.



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/stupidedi/config/functional_group_config.rb', line 51

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.



36
37
38
39
40
41
42
# File 'lib/stupidedi/config/functional_group_config.rb', line 36

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