Class: NcsNavigator::Mdes::CodeListEntry
- Inherits:
-
Object
- Object
- NcsNavigator::Mdes::CodeListEntry
- Defined in:
- lib/ncs_navigator/mdes/code_list.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
-
#diff(other, options = {}) ⇒ Differences::Entry?
Computes the differences between this code list entry and the other.
-
#initialize(value) ⇒ CodeListEntry
constructor
A new instance of CodeListEntry.
Constructor Details
#initialize(value) ⇒ CodeListEntry
Returns a new instance of CodeListEntry.
63 64 65 |
# File 'lib/ncs_navigator/mdes/code_list.rb', line 63 def initialize(value) @value = value end |
Instance Attribute Details
#global_value ⇒ String
Returns the MDES's globally-unique identifier for this coded value.
32 33 34 |
# File 'lib/ncs_navigator/mdes/code_list.rb', line 32 def global_value @global_value end |
#label ⇒ String
Returns the human-readable label for the entry.
27 28 29 |
# File 'lib/ncs_navigator/mdes/code_list.rb', line 27 def label @label end |
#master_cl ⇒ String
Returns the name of MDES's master code list from which this value is derived.
37 38 39 |
# File 'lib/ncs_navigator/mdes/code_list.rb', line 37 def master_cl @master_cl end |
#value ⇒ String (readonly) Also known as: to_s
Returns the local code value for the entry.
23 24 25 |
# File 'lib/ncs_navigator/mdes/code_list.rb', line 23 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.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/ncs_navigator/mdes/code_list.rb', line 50 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['ncsdoc:label'] cle.global_value = enum['ncsdoc:global_value'] cle.master_cl = enum['ncsdoc:master_cl'] end end |
Instance Method Details
#diff(other, options = {}) ⇒ Differences::Entry?
Computes the differences between this code list entry and the other.
90 91 92 |
# File 'lib/ncs_navigator/mdes/code_list.rb', line 90 def diff(other, ={}) Differences::Entry.compute(self, other, diff_criteria(), ) end |