Class: Stupidedi::Schema::InterchangeDef
- Inherits:
-
AbstractDef
show all
- Includes:
- Inspect
- Defined in:
- lib/stupidedi/schema/interchange_def.rb
Overview
Instance Attribute Summary (collapse)
Instance Method Summary
(collapse)
Methods included from Inspect
#inspect
Methods inherited from AbstractDef
#component?, #composite?, #definition?, #element?, #functional_group?, #loop?, #repeated?, #segment?, #simple?, #table?, #transaction_set?, #usage?
Constructor Details
- (InterchangeDef) initialize(id, header_segment_uses, trailer_segment_uses)
A new instance of InterchangeDef
26
27
28
29
30
31
32
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 26
def initialize(id, , trailer_segment_uses)
@id, @header_segment_uses, @trailer_segment_uses =
id, , trailer_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
15
16
17
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 15
def
@header_segment_uses
end
|
12
13
14
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 12
def id
@id
end
|
18
19
20
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 18
def trailer_segment_uses
@trailer_segment_uses
end
|
Instance Method Details
48
49
50
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 48
def children
@header_segment_uses + @trailer_segment_uses
end
|
- (AbstractSet<CodeList>) code_lists
58
59
60
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 58
def code_lists
children.map(&:code_lists).inject(&:|)
end
|
35
36
37
38
39
40
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 35
def copy(changes = {})
InterchangeDef.new \
changes.fetch(:id, @id),
changes.fetch(:header_segment_uses, @header_segment_uses),
changes.fetch(:trailer_segment_uses, @trailer_segment_uses)
end
|
21
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 21
abstract :empty, :args => %w(separators)
|
- (SegmentUse) entry_segment_use
43
44
45
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 43
def entry_segment_use
@header_segment_uses.head
end
|
- (Boolean) interchange?
53
54
55
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 53
def interchange?
true
end
|
- pretty_print(q)
This method returns an undefined value.
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 63
def pretty_print(q)
q.text("InterchangeDef[#{id}]")
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 "... (FUNCTIONAL GROUPS) ..."
@trailer_segment_uses.each do |e|
unless q.current_group.first?
q.text ","
q.breakable
end
q.pp e
end
end
end
|
24
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 24
abstract :separators, :args => %w(isa_segment_val)
|