Class: Eddy::Models::Element::ID
- Inherits:
-
Base
- Object
- Base
- Eddy::Models::Element::ID
show all
- Defined in:
- lib/eddy/models/element/id.rb
Overview
Identifier (works with a code list specified by the dictionary).
Direct Known Subclasses
Elements::E1005, Elements::E1019, Elements::E1166, Elements::E1232, Elements::E128, Elements::E1300, Elements::E133, Elements::E143, Elements::E156, Elements::E187, Elements::E23, Elements::E235, Elements::E236, Elements::E248, Elements::E26, Elements::E284, Elements::E349, Elements::E353, Elements::E355, Elements::E368, Elements::E374, Elements::E455, Elements::E479, Elements::E559, Elements::E587, Elements::E639, Elements::E640, Elements::E648, Elements::E66, Elements::E662, Elements::E668, Elements::E687, Elements::E735, Elements::E736, Elements::E750, Elements::E786, Elements::E88, Elements::E91, Elements::E92, Elements::E98, Elements::I01, Elements::I03, Elements::I05, Elements::I10, Elements::I11, Elements::I13, Elements::I14
Instance Attribute Summary
Attributes inherited from Base
#description, #id, #max, #min, #name, #ref, #type
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#doc_comment, #req, #req=
Constructor Details
#initialize(min:, max:, req: nil, ref: nil, val: nil) ⇒ void
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/eddy/models/element/id.rb', line 13
def initialize(
min:,
max:,
req: nil,
ref: nil,
val: nil
)
@type = "ID"
@min = min
@max = max
self.req = req
self.ref = ref
self.value = val
end
|
Class Method Details
.process_value(val) ⇒ String
56
57
58
|
# File 'lib/eddy/models/element/id.rb', line 56
def self.process_value(val)
return val
end
|
Instance Method Details
#code_list ⇒ Array<String>
61
62
63
|
# File 'lib/eddy/models/element/id.rb', line 61
def code_list()
raise NotImplementedError, "Each ID element must define its own code_list"
end
|
#process_value ⇒ String
50
51
52
|
# File 'lib/eddy/models/element/id.rb', line 50
def process_value()
return self.class.process_value(@val)
end
|
#value ⇒ String
45
46
47
|
# File 'lib/eddy/models/element/id.rb', line 45
def value()
return super()
end
|
#value=(arg) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/eddy/models/element/id.rb', line 30
def value=(arg)
if arg == :skip
@val = :skip
return
end
if arg.nil?()
@val = arg
return
end
raise Eddy::Errors::ElementValidationError.new("Value not present in code list: #{arg}", element: self) unless self.code_list().include?(arg)
@val = arg
end
|