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.
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/stupidedi/schema/segment_use.rb', line 37
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
16
17
18
|
# File 'lib/stupidedi/schema/segment_use.rb', line 16
def definition
@definition
end
|
30
31
32
|
# File 'lib/stupidedi/schema/segment_use.rb', line 30
def parent
@parent
end
|
13
14
15
|
# File 'lib/stupidedi/schema/segment_use.rb', line 13
def position
@position
end
|
27
28
29
|
# File 'lib/stupidedi/schema/segment_use.rb', line 27
def repeat_count
@repeat_count
end
|
21
22
23
|
# File 'lib/stupidedi/schema/segment_use.rb', line 21
def requirement
@requirement
end
|
Instance Method Details
#copy(changes = {}) ⇒ SegmentUse
49
50
51
52
53
54
55
56
|
# File 'lib/stupidedi/schema/segment_use.rb', line 49
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
63
64
65
|
# File 'lib/stupidedi/schema/segment_use.rb', line 63
def empty(position)
definition.empty(self, position)
end
|
#pretty_print(q) ⇒ void
This method returns an undefined value.
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/stupidedi/schema/segment_use.rb', line 77
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
58
59
60
|
# File 'lib/stupidedi/schema/segment_use.rb', line 58
def repeatable?
@repeat_count.try{|r| r.include?(2) }
end
|
72
73
74
|
# File 'lib/stupidedi/schema/segment_use.rb', line 72
def segment?
true
end
|
#value(element_vals, position) ⇒ Object
67
68
69
|
# File 'lib/stupidedi/schema/segment_use.rb', line 67
def value(element_vals, position)
definition.value(element_vals, self, position)
end
|