Class: Stupidedi::Schema::SimpleElementUse
Instance Attribute Summary collapse
Instance Method Summary
collapse
#composite?, #empty, #value
Methods included from Inspect
#inspect
Methods inherited from AbstractUse
#composite?, #definition?, #element?, #functional_group?, #interchange?, #loop?, #repeated?, #segment?, #table?, #transaction_set?, #usage?
Constructor Details
#initialize(definition, requirement, repeat_count, allowed_values, parent) ⇒ SimpleElementUse
Returns a new instance of SimpleElementUse.
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/stupidedi/schema/element_use.rb', line 53
def initialize(definition, requirement, repeat_count, allowed_values, parent)
@definition, @requirement, @repeat_count, @allowed_values, @parent =
definition, requirement, repeat_count, allowed_values, parent
unless parent.nil?
@definition = @definition.copy(:parent => self)
end
end
|
Instance Attribute Details
#allowed_values ⇒ AbstractSet
48
49
50
|
# File 'lib/stupidedi/schema/element_use.rb', line 48
def allowed_values
@allowed_values
end
|
39
40
41
|
# File 'lib/stupidedi/schema/element_use.rb', line 39
def definition
@definition
end
|
51
52
53
|
# File 'lib/stupidedi/schema/element_use.rb', line 51
def parent
@parent
end
|
45
46
47
|
# File 'lib/stupidedi/schema/element_use.rb', line 45
def repeat_count
@repeat_count
end
|
42
43
44
|
# File 'lib/stupidedi/schema/element_use.rb', line 42
def requirement
@requirement
end
|
Instance Method Details
#code_lists ⇒ AbstractSet<CodeList>
94
95
96
97
98
99
100
|
# File 'lib/stupidedi/schema/element_use.rb', line 94
def code_lists
if forbidden?
Sets.empty
else
@definition.code_lists(@allowed_values)
end
end
|
#component? ⇒ Boolean
89
90
91
|
# File 'lib/stupidedi/schema/element_use.rb', line 89
def component?
false
end
|
65
66
67
68
69
70
71
72
|
# File 'lib/stupidedi/schema/element_use.rb', line 65
def copy(changes = {})
SimpleElementUse.new \
changes.fetch(:definition, @definition),
changes.fetch(:requirement, @requirement),
changes.fetch(:repeat_count, @repeat_count),
changes.fetch(:allowed_values, @allowed_values),
changes.fetch(:parent, @parent)
end
|
#parse(string) ⇒ SimpleElementVal
75
76
77
|
# File 'lib/stupidedi/schema/element_use.rb', line 75
def parse(string)
definition.parse(string, self)
end
|
#pretty_print(q) ⇒ void
This method returns an undefined value.
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
# File 'lib/stupidedi/schema/element_use.rb', line 103
def pretty_print(q)
q.text("SimpleElementUse")
q.group(2, "(", ")") do
q.breakable ""
q.pp @definition
q.text ","
q.breakable
q.pp @requirement
q.text ","
q.breakable
q.pp @repeat_count
end
end
|
#repeatable? ⇒ Boolean
79
80
81
|
# File 'lib/stupidedi/schema/element_use.rb', line 79
def repeatable?
@repeat_count.try{|r| r.include?(2) }
end
|
#simple? ⇒ Boolean
84
85
86
|
# File 'lib/stupidedi/schema/element_use.rb', line 84
def simple?
true
end
|