Class: Stupidedi::Schema::InterchangeDef
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
#initialize(id, header_segment_uses, trailer_segment_uses) ⇒ InterchangeDef
Returns a new instance of InterchangeDef.
28
29
30
31
32
33
34
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 28
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
17
18
19
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 17
def
@header_segment_uses
end
|
#id ⇒ String
14
15
16
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 14
def id
@id
end
|
#trailer_segment_uses ⇒ Array<SegmentUse>
20
21
22
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 20
def trailer_segment_uses
@trailer_segment_uses
end
|
Instance Method Details
59
60
61
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 59
def children
@header_segment_uses + @trailer_segment_uses
end
|
#code_lists ⇒ AbstractSet<CodeList>
69
70
71
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 69
def code_lists
children.map(&:code_lists).inject(&:|)
end
|
37
38
39
40
41
42
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 37
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
|
#descriptor ⇒ String
49
50
51
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 49
def descriptor
"interchange #{id}"
end
|
23
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 23
abstract :empty, :args => %w(separators)
|
#entry_segment_use ⇒ SegmentUse
54
55
56
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 54
def entry_segment_use
@header_segment_uses.head
end
|
#interchange? ⇒ Boolean
64
65
66
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 64
def interchange?
true
end
|
#pretty_print(q)
This method returns an undefined value.
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 74
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
|
#required? ⇒ Boolean
44
45
46
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 44
def required?
false
end
|
26
|
# File 'lib/stupidedi/schema/interchange_def.rb', line 26
abstract :separators, :args => %w(isa_segment_val)
|