Class: Stupidedi::Schema::FunctionalGroupDef

Inherits:
AbstractDef
  • Object
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


47
48
49
50
51
52
53
# File 'lib/stupidedi/schema/functional_group_def.rb', line 47

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)


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

def header_segment_uses
  @header_segment_uses
end

#idString (readonly)


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

def id
  @id
end

#trailer_segment_usesArray<SegmentUses> (readonly)


42
43
44
# File 'lib/stupidedi/schema/functional_group_def.rb', line 42

def trailer_segment_uses
  @trailer_segment_uses
end

Instance Method Details

#childrenArray<SegmentUse>


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

def children
  @header_segment_uses + @trailer_segment_uses
end

#code_listsAbstractSet<CodeList>


83
84
85
# File 'lib/stupidedi/schema/functional_group_def.rb', line 83

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

#copy(changes = {}) ⇒ FunctionalGroupDef


56
57
58
59
60
61
# File 'lib/stupidedi/schema/functional_group_def.rb', line 56

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


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

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

#entry_segment_useSegmentUse


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

def entry_segment_use
  @header_segment_uses.head
end

#functional_group?Boolean


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

def functional_group?
  true
end

#pretty_print(q)


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

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


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

abstract :segment_dict