Class: Stupidedi::Schema::SimpleElementUse
Instance Attribute Summary collapse
Instance Method Summary
collapse
#composite?, #description, #empty, #id, #name, #value
Methods included from Inspect
#inspect
Methods inherited from AbstractUse
#composite?, #definition?, #element?, #functional_group?, #id, #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.
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/stupidedi/schema/simple_element_use.rb', line 24
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
19
20
21
|
# File 'lib/stupidedi/schema/simple_element_use.rb', line 19
def allowed_values
@allowed_values
end
|
8
9
10
|
# File 'lib/stupidedi/schema/simple_element_use.rb', line 8
def definition
@definition
end
|
22
23
24
|
# File 'lib/stupidedi/schema/simple_element_use.rb', line 22
def parent
@parent
end
|
16
17
18
|
# File 'lib/stupidedi/schema/simple_element_use.rb', line 16
def repeat_count
@repeat_count
end
|
13
14
15
|
# File 'lib/stupidedi/schema/simple_element_use.rb', line 13
def requirement
@requirement
end
|
Instance Method Details
#component? ⇒ Boolean
61
62
63
|
# File 'lib/stupidedi/schema/simple_element_use.rb', line 61
def component?
false
end
|
36
37
38
39
40
41
42
43
|
# File 'lib/stupidedi/schema/simple_element_use.rb', line 36
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
|
#descriptor ⇒ String
46
47
48
49
|
# File 'lib/stupidedi/schema/simple_element_use.rb', line 46
def descriptor
idx = parent.element_uses.index{|u| u.eql?(self) } + 1
"element #{parent.id}#{"%02d" % idx} #{definition.name}".strip
end
|
#pretty_print(q)
This method returns an undefined value.
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/stupidedi/schema/simple_element_use.rb', line 66
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
51
52
53
|
# File 'lib/stupidedi/schema/simple_element_use.rb', line 51
def repeatable?
@repeat_count.try{|r| r.include?(2) }
end
|
#simple? ⇒ Boolean
56
57
58
|
# File 'lib/stupidedi/schema/simple_element_use.rb', line 56
def simple?
true
end
|