Class: Stupidedi::Schema::SegmentUse
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Inspect
#inspect
Methods inherited from AbstractUse
#component?, #composite?, #definition?, #descriptor, #element?, #functional_group?, #id, #interchange?, #loop?, #repeated?, #simple?, #table?, #transaction_set?, #usage?
Constructor Details
#initialize(definition, position, requirement, repeat_count, parent) ⇒ SegmentUse
Returns a new instance of SegmentUse.
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/stupidedi/schema/segment_use.rb', line 38
def initialize(definition, position, requirement, repeat_count, parent)
@definition, @position, @requirement, @repeat_count, @parent =
definition, position, requirement, repeat_count, parent
unless parent.nil?
@definition = @definition.copy(:parent => self)
end
end
|
Instance Attribute Details
18
19
20
|
# File 'lib/stupidedi/schema/segment_use.rb', line 18
def definition
@definition
end
|
36
37
38
|
# File 'lib/stupidedi/schema/segment_use.rb', line 36
def parent
@parent
end
|
#position ⇒ Integer
15
16
17
|
# File 'lib/stupidedi/schema/segment_use.rb', line 15
def position
@position
end
|
33
34
35
|
# File 'lib/stupidedi/schema/segment_use.rb', line 33
def repeat_count
@repeat_count
end
|
25
26
27
|
# File 'lib/stupidedi/schema/segment_use.rb', line 25
def requirement
@requirement
end
|
Instance Method Details
#copy(changes = {}) ⇒ SegmentUse
50
51
52
53
54
55
56
57
|
# File 'lib/stupidedi/schema/segment_use.rb', line 50
def copy(changes = {})
SegmentUse.new \
changes.fetch(:definition, @definition),
changes.fetch(:position, @position),
changes.fetch(:requirement, @requirement),
changes.fetch(:repeat_count, @repeat_count),
changes.fetch(:parent, @parent)
end
|
#empty(position) ⇒ SegmentVal
64
65
66
|
# File 'lib/stupidedi/schema/segment_use.rb', line 64
def empty(position)
definition.empty(self, position)
end
|
#pretty_print(q)
This method returns an undefined value.
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
# File 'lib/stupidedi/schema/segment_use.rb', line 78
def pretty_print(q)
q.text "SegmentUse"
q.group(2, "(", ")") do
q.breakable ""
q.pp @position
q.text ","
q.breakable
q.pp @definition
q.text ","
q.breakable
q.pp @requirement
q.text ","
q.breakable
q.pp @repeat_count
end
end
|
#repeatable? ⇒ Boolean
59
60
61
|
# File 'lib/stupidedi/schema/segment_use.rb', line 59
def repeatable?
@repeat_count.try{|r| r.include?(2) }
end
|
#segment?
73
74
75
|
# File 'lib/stupidedi/schema/segment_use.rb', line 73
def segment?
true
end
|
#value(element_vals, position)
68
69
70
|
# File 'lib/stupidedi/schema/segment_use.rb', line 68
def value(element_vals, position)
definition.value(element_vals, self, position)
end
|