Class: HQMF2::TemporalReference
- Inherits:
-
Object
- Object
- HQMF2::TemporalReference
- Includes:
- Utilities
- Defined in:
- lib/hqmf-parser/2.0/types.rb
Overview
Represents a time bounded reference. Wraps the “Range” class
Constant Summary collapse
- UPDATED_TYPES =
Use updated mappings to HDS temporal reference types (as used in SimpleXML Parser) github.com/projecttacoma/simplexml_parser/blob/fa0f589d98059b88d77dc3cb465b62184df31671/lib/model/types.rb#L167
{ 'EAOCW' => 'EACW', 'EAEORECW' => 'EACW', 'EAOCWSO' => 'EACWS', 'EASORECWS' => 'EACWS', 'EBOCW' => 'EBCW', 'EBEORECW' => 'EBCW', 'EBOCWSO' => 'EBCWS', 'EBSORECWS' => 'EBCWS', 'ECWSO' => 'ECWS', 'SAOCWEO' => 'SACWE', 'SAEORSCWE' => 'SACWE', 'SAOCW' => 'SACW', 'SASORSCW' => 'SACW', 'SBOCWEO' => 'SBCWE', 'SBEORSCWE' => 'SBCWE', 'SBOCW' => 'SBCW', 'SBSORSCW' => 'SBCW', 'SCWEO' => 'SCWE', 'OVERLAPS' => 'OVERLAP' }
Instance Attribute Summary collapse
-
#range ⇒ Object
readonly
Returns the value of attribute range.
-
#reference ⇒ Object
readonly
Returns the value of attribute reference.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(entry) ⇒ TemporalReference
constructor
A new instance of TemporalReference.
-
#to_model ⇒ Object
Generates this classes hqmf-model equivalent.
Methods included from Utilities
#attr_val, attr_val, #strip_tokens, #to_xml
Methods included from HQMF::Conversion::Utilities
#build_hash, #check_equality, #json_array, #openstruct_to_json
Constructor Details
#initialize(entry) ⇒ TemporalReference
Returns a new instance of TemporalReference.
354 355 356 357 358 359 360 |
# File 'lib/hqmf-parser/2.0/types.rb', line 354 def initialize(entry) @entry = entry @type = UPDATED_TYPES[attr_val('./@typeCode')] || attr_val('./@typeCode') @reference = Reference.new(@entry.at_xpath('./*/cda:id', HQMF2::Document::NAMESPACES)) range_def = @entry.at_xpath('./qdm:temporalInformation/qdm:delta', HQMF2::Document::NAMESPACES) @range = HQMF2::Range.new(range_def, 'IVL_PQ') if range_def end |
Instance Attribute Details
#range ⇒ Object (readonly)
Returns the value of attribute range.
328 329 330 |
# File 'lib/hqmf-parser/2.0/types.rb', line 328 def range @range end |
#reference ⇒ Object (readonly)
Returns the value of attribute reference.
328 329 330 |
# File 'lib/hqmf-parser/2.0/types.rb', line 328 def reference @reference end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
328 329 330 |
# File 'lib/hqmf-parser/2.0/types.rb', line 328 def type @type end |
Instance Method Details
#to_model ⇒ Object
Generates this classes hqmf-model equivalent
363 364 365 366 |
# File 'lib/hqmf-parser/2.0/types.rb', line 363 def to_model rm = range ? range.to_model : nil HQMF::TemporalReference.new(type, reference.to_model, rm) end |