Class: Stupidedi::Versions::FunctionalGroups::ThirtyTen::ElementTypes::SimpleElementDef
Instance Attribute Summary collapse
Instance Method Summary
collapse
#code_lists, #component_use, #composite?, #simple?, #simple_use
#code_lists, #element?
Methods included from Inspect
#inspect
#component?, #composite?, #definition?, #element?, #functional_group?, #interchange?, #loop?, #repeated?, #segment?, #simple?, #table?, #transaction_set?, #usage?
Constructor Details
#initialize(id, name, min_length, max_length, description = nil, parent = nil) ⇒ SimpleElementDef
Returns a new instance of SimpleElementDef.
32
33
34
35
36
37
38
39
40
|
# File 'lib/stupidedi/versions/functional_groups/003010/element_types.rb', line 32
def initialize(id, name, min_length, max_length, description = nil, parent = nil)
@id, @name, @min_length, @max_length, @description, @parent =
id, name, min_length, max_length, description, parent
if min_length > max_length
raise ArgumentError,
"min_length cannot be greater than max_length"
end
end
|
Instance Attribute Details
#description ⇒ String
18
19
20
|
# File 'lib/stupidedi/versions/functional_groups/003010/element_types.rb', line 18
def description
@description
end
|
#id ⇒ Symbol
12
13
14
|
# File 'lib/stupidedi/versions/functional_groups/003010/element_types.rb', line 12
def id
@id
end
|
#max_length ⇒ Integer
24
25
26
|
# File 'lib/stupidedi/versions/functional_groups/003010/element_types.rb', line 24
def max_length
@max_length
end
|
#min_length ⇒ Integer
21
22
23
|
# File 'lib/stupidedi/versions/functional_groups/003010/element_types.rb', line 21
def min_length
@min_length
end
|
#name ⇒ String
15
16
17
|
# File 'lib/stupidedi/versions/functional_groups/003010/element_types.rb', line 15
def name
@name
end
|
27
28
29
|
# File 'lib/stupidedi/versions/functional_groups/003010/element_types.rb', line 27
def parent
@parent
end
|
Instance Method Details
30
|
# File 'lib/stupidedi/versions/functional_groups/003010/element_types.rb', line 30
abstract :companion
|
43
44
45
46
47
48
49
50
51
|
# File 'lib/stupidedi/versions/functional_groups/003010/element_types.rb', line 43
def copy(changes = {})
self.class.new \
changes.fetch(:id, @id),
changes.fetch(:name, @name),
changes.fetch(:min_length, @min_length),
changes.fetch(:max_length, @max_length),
changes.fetch(:description, @description),
changes.fetch(:parent, @parent)
end
|
Constructs an empty SimpleElementVal
70
71
72
|
# File 'lib/stupidedi/versions/functional_groups/003010/element_types.rb', line 70
def empty(usage, position)
companion.empty(usage, position)
end
|
Constructs a SimpleElementVal from the given ‘String`
56
57
58
|
# File 'lib/stupidedi/versions/functional_groups/003010/element_types.rb', line 56
def parse(string, usage)
companion.parse(string, usage)
end
|
#pretty_print(q) ⇒ void
This method returns an undefined value.
75
76
77
78
79
80
81
82
83
|
# File 'lib/stupidedi/versions/functional_groups/003010/element_types.rb', line 75
def pretty_print(q)
type = self.class.name.try{|n| n.split('::').last }
if type.blank?
q.text @id.to_s
else
q.text "#{type}[#{@id}]"
end
end
|
Constructs a SimpleElementVal from the given ‘value`
63
64
65
|
# File 'lib/stupidedi/versions/functional_groups/003010/element_types.rb', line 63
def value(object, usage, position)
companion.value(object, usage, position)
end
|