Class: HQMF2::TemporalReference

Inherits:
Object
  • Object
show all
Includes:
Utilities
Defined in:
lib/hqmf-parser/2.0/types.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utilities

#attr_val, attr_val, #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.



211
212
213
214
215
216
217
218
219
# File 'lib/hqmf-parser/2.0/types.rb', line 211

def initialize(entry)
  @entry = entry
  @type = attr_val('./@typeCode')
  @reference = Reference.new(@entry.at_xpath('./*/cda:id', HQMF2::Document::NAMESPACES))
  range_def = @entry.at_xpath('./cda:pauseQuantity', HQMF2::Document::NAMESPACES)
  if range_def
    @range = HQMF2::Range.new(range_def, 'PQ')
  end
end

Instance Attribute Details

#rangeObject (readonly)

Returns the value of attribute range.



209
210
211
# File 'lib/hqmf-parser/2.0/types.rb', line 209

def range
  @range
end

#referenceObject (readonly)

Returns the value of attribute reference.



209
210
211
# File 'lib/hqmf-parser/2.0/types.rb', line 209

def reference
  @reference
end

#typeObject (readonly)

Returns the value of attribute type.



209
210
211
# File 'lib/hqmf-parser/2.0/types.rb', line 209

def type
  @type
end

Instance Method Details

#to_modelObject



221
222
223
224
# File 'lib/hqmf-parser/2.0/types.rb', line 221

def to_model
  rm = range ? range.to_model : nil
  HQMF::TemporalReference.new(type, reference.to_model, rm)
end