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 Attribute Summary collapse

Instance Method Summary collapse

Methods included from Inspect

#inspect

Constructor Details

#initializeFunctionalGroupConfig

Returns a new instance of FunctionalGroupConfig.



29
30
31
# File 'lib/stupidedi/config/functional_group_config.rb', line 29

def initialize
  @table = Hash.new
end

Instance Attribute Details

#tableHash<String, FunctionalGroupDef> (readonly)

Returns:

  • (Hash<String, FunctionalGroupDef>)


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

def table
  @table
end

Instance Method Details

#at(version) ⇒ FunctionalGroupDef

Returns:

  • (FunctionalGroupDef)


47
48
49
50
# File 'lib/stupidedi/config/functional_group_config.rb', line 47

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

#customize(&block)



33
34
35
# File 'lib/stupidedi/config/functional_group_config.rb', line 33

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

#pretty_print(q)

This method returns an undefined value.



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

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)

This method returns an undefined value.



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

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