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

Returns a new instance of FunctionalGroupDef.


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

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:

  • (Array<SegmentUses>)

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

def header_segment_uses
  @header_segment_uses
end

#idString (readonly)

Returns:

  • (String)

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

def id
  @id
end

#trailer_segment_usesArray<SegmentUses> (readonly)

Returns:

  • (Array<SegmentUses>)

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

def trailer_segment_uses
  @trailer_segment_uses
end

Instance Method Details

#childrenArray<SegmentUse>

Returns:


76
77
78
# File 'lib/stupidedi/schema/functional_group_def.rb', line 76

def children
  @header_segment_uses + @trailer_segment_uses
end

#code_listsAbstractSet<CodeList>

Returns AbstractSet.

Returns:

  • (AbstractSet<CodeList>)

    AbstractSet


90
91
92
# File 'lib/stupidedi/schema/functional_group_def.rb', line 90

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

#copy(changes = {}) ⇒ FunctionalGroupDef

Returns:


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

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

#descriptorString

Returns:

  • (String)

62
63
64
# File 'lib/stupidedi/schema/functional_group_def.rb', line 62

def descriptor
  "transaction set #{id}"
end

#emptyValues::FunctionalGroupVal


81
82
83
# File 'lib/stupidedi/schema/functional_group_def.rb', line 81

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

#entry_segment_useSegmentUse

Returns:


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

def entry_segment_use
  @header_segment_uses.head
end

#functional_group?Boolean

Returns:

  • (Boolean)

85
86
87
# File 'lib/stupidedi/schema/functional_group_def.rb', line 85

def functional_group?
  true
end

#pretty_print(q)

This method returns an undefined value.


95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/stupidedi/schema/functional_group_def.rb', line 95

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

#required?Boolean

Returns:

  • (Boolean)

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

def required?
  false
end

#segment_dictHash, Module

Returns:

  • (Hash, Module)

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

abstract :segment_dict