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?, #element?, #functional_group?, #interchange?, #loop?, #repeated?, #simple?, #table?, #transaction_set?, #usage?
Constructor Details
#initialize(definition, position, requirement, repeat_count, parent) ⇒ SegmentUse
Returns a new instance of SegmentUse.
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/stupidedi/schema/segment_use.rb', line 40
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
20
21
22
|
# File 'lib/stupidedi/schema/segment_use.rb', line 20
def definition
@definition
end
|
34
35
36
|
# File 'lib/stupidedi/schema/segment_use.rb', line 34
def parent
@parent
end
|
#position ⇒ Integer
17
18
19
|
# File 'lib/stupidedi/schema/segment_use.rb', line 17
def position
@position
end
|
31
32
33
|
# File 'lib/stupidedi/schema/segment_use.rb', line 31
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
52
53
54
55
56
57
58
59
|
# File 'lib/stupidedi/schema/segment_use.rb', line 52
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
66
67
68
|
# File 'lib/stupidedi/schema/segment_use.rb', line 66
def empty(position)
definition.empty(self, position)
end
|
#pretty_print(q) ⇒ void
This method returns an undefined value.
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/stupidedi/schema/segment_use.rb', line 80
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
61
62
63
|
# File 'lib/stupidedi/schema/segment_use.rb', line 61
def repeatable?
@repeat_count.try{|r| r.include?(2) }
end
|
#segment? ⇒ Object
75
76
77
|
# File 'lib/stupidedi/schema/segment_use.rb', line 75
def segment?
true
end
|
#value(element_vals, position) ⇒ Object
70
71
72
|
# File 'lib/stupidedi/schema/segment_use.rb', line 70
def value(element_vals, position)
definition.value(element_vals, self, position)
end
|