Class: Stupidedi::Schema::FunctionalGroupDef

Inherits:
AbstractDef show all
Includes:
Inspect
Defined in:
lib/stupidedi/schema/functional_group_def.rb

Overview

X12 standards are released three times yearly. The version codes sent in the ‘GS08` and `ST03` elements encode the version (eg 004, 005), the release (eg 0040, 0050), the subrelease (00501, 00602) and the level (eg 005010)

The release schedules look like this:

          Approved by    Available      Ballot Results  Available for
Version   Subcommitees   for Ballot     Approved        Distribution
---------------------------------------------------------------------
 005010     Feb 03         Jun 03         Oct 03          Jan 04
 005011     Jun 03         Oct 04         Feb 04          Mar 04
 005012     Oct 03         Feb 04         Jun 04          Jul 04

 005020     Feb 04         Jun 04         Oct 04          Jan 05
 005021     Jun 04         Oct 04         Feb 05          Mar 05
 005022     Oct 04         Feb 05         Jun 05          Jul 05

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Inspect

#inspect

Methods inherited from AbstractDef

#component?, #composite?, #definition?, #element?, #interchange?, #loop?, #repeated?, #segment?, #simple?, #table?, #transaction_set?, #usage?

Constructor Details

#initialize(id, header_segment_uses, trailer_segment_uses) ⇒ FunctionalGroupDef

Returns a new instance of FunctionalGroupDef.



43
44
45
46
47
48
49
# File 'lib/stupidedi/schema/functional_group_def.rb', line 43

def initialize(id, header_segment_uses, trailer_segment_uses)
  @id, @header_segment_uses, @trailer_segment_uses =
    id, header_segment_uses, trailer_segment_uses

  @header_segment_uses  = header_segment_uses.map{|x| x.copy(:parent => self) }
  @trailer_segment_uses = trailer_segment_uses.map{|x| x.copy(:parent => self) }
end

Instance Attribute Details

#header_segment_usesArray<SegmentUses> (readonly)

Returns:



35
36
37
# File 'lib/stupidedi/schema/functional_group_def.rb', line 35

def header_segment_uses
  @header_segment_uses
end

#idString (readonly)

Returns:



32
33
34
# File 'lib/stupidedi/schema/functional_group_def.rb', line 32

def id
  @id
end

#trailer_segment_usesArray<SegmentUses> (readonly)

Returns:



38
39
40
# File 'lib/stupidedi/schema/functional_group_def.rb', line 38

def trailer_segment_uses
  @trailer_segment_uses
end

Instance Method Details

#childrenArray<SegmentUse>

Returns:



65
66
67
# File 'lib/stupidedi/schema/functional_group_def.rb', line 65

def children
  @header_segment_uses + @trailer_segment_uses
end

#code_listsAbstractSet<CodeList>

Returns AbstractSet<CodeList>.

Returns:

  • (AbstractSet<CodeList>)

    AbstractSet<CodeList>



79
80
81
# File 'lib/stupidedi/schema/functional_group_def.rb', line 79

def code_lists
  children.map(&:code_lists).inject(&:|)
end

#copy(changes = {}) ⇒ FunctionalGroupDef

Returns:



52
53
54
55
56
57
# File 'lib/stupidedi/schema/functional_group_def.rb', line 52

def copy(changes = {})
  FunctionalGroupDef.new \
    changes.fetch(:id, @id),
    changes.fetch(:header_segment_uses, @header_segment_uses),
    changes.fetch(:trailer_segment_uses, @trailer_segment_uses)
end

#emptyValues::FunctionalGroupVal



70
71
72
# File 'lib/stupidedi/schema/functional_group_def.rb', line 70

def empty
  Values::FunctionalGroupVal.new(self, [], [])
end

#entry_segment_useSegmentUse

Returns:



60
61
62
# File 'lib/stupidedi/schema/functional_group_def.rb', line 60

def entry_segment_use
  @header_segment_uses.head
end

#functional_group?Boolean

Returns:

  • (Boolean)


74
75
76
# File 'lib/stupidedi/schema/functional_group_def.rb', line 74

def functional_group?
  true
end

#pretty_print(q) ⇒ void

This method returns an undefined value.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/stupidedi/schema/functional_group_def.rb', line 84

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

    unless q.current_group.first?
      q.text ","
      q.breakable
    end
    q.text "... (TRANSACTION SETS) ..."

    @trailer_segment_uses.each do |e|
      unless q.current_group.first?
        q.text ","
        q.breakable
      end
      q.pp e
    end
  end
end

#segment_dictHash, Module

Returns:



41
# File 'lib/stupidedi/schema/functional_group_def.rb', line 41

abstract :segment_dict