Class: NcsNavigator::Mdes::VariableType::CodeListEntry
- Inherits:
-
Object
- Object
- NcsNavigator::Mdes::VariableType::CodeListEntry
- Defined in:
- lib/ncs_navigator/mdes/variable_type.rb
Overview
A single entry in a code list.
Instance Attribute Summary collapse
-
#global_value ⇒ String
The MDES's globally-unique identifier for this coded value.
-
#label ⇒ String
The human-readable label for the entry.
-
#master_cl ⇒ String
The name of MDES's master code list from which this value is derived.
-
#value ⇒ String
(also: #to_s)
readonly
The local code value for the entry.
Class Method Summary collapse
-
.from_xsd_enumeration(enum, options = {}) ⇒ CodeListEntry
Creates a new instance from a
xs:enumeration
simple type restriction subelement.
Instance Method Summary collapse
-
#initialize(value) ⇒ CodeListEntry
constructor
A new instance of CodeListEntry.
Constructor Details
#initialize(value) ⇒ CodeListEntry
Returns a new instance of CodeListEntry.
189 190 191 |
# File 'lib/ncs_navigator/mdes/variable_type.rb', line 189 def initialize(value) @value = value end |
Instance Attribute Details
#global_value ⇒ String
Returns the MDES's globally-unique identifier for this coded value.
158 159 160 |
# File 'lib/ncs_navigator/mdes/variable_type.rb', line 158 def global_value @global_value end |
#label ⇒ String
Returns the human-readable label for the entry.
153 154 155 |
# File 'lib/ncs_navigator/mdes/variable_type.rb', line 153 def label @label end |
#master_cl ⇒ String
Returns the name of MDES's master code list from which this value is derived.
163 164 165 |
# File 'lib/ncs_navigator/mdes/variable_type.rb', line 163 def master_cl @master_cl end |
#value ⇒ String (readonly) Also known as: to_s
Returns the local code value for the entry.
149 150 151 |
# File 'lib/ncs_navigator/mdes/variable_type.rb', line 149 def value @value end |
Class Method Details
.from_xsd_enumeration(enum, options = {}) ⇒ CodeListEntry
Creates a new instance from a xs:enumeration
simple type
restriction subelement.
176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/ncs_navigator/mdes/variable_type.rb', line 176 def from_xsd_enumeration(enum, ={}) log = [:log] || NcsNavigator::Mdes.default_logger log.warn("Missing value for code list entry on line #{enum.line}") unless enum['value'] new(enum['value'] && enum['value'].strip).tap do |cle| cle.label = enum['label'] cle.global_value = enum['global_value'] cle.master_cl = enum['master_cl'] end end |