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.



190
191
192
193
194
195
196
197
198
# File 'lib/hqmf-parser/2.0/types.rb', line 190

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, 'IVL_PQ')
  end
end

Instance Attribute Details

#rangeObject (readonly)

Returns the value of attribute range.



188
189
190
# File 'lib/hqmf-parser/2.0/types.rb', line 188

def range
  @range
end

#referenceObject (readonly)

Returns the value of attribute reference.



188
189
190
# File 'lib/hqmf-parser/2.0/types.rb', line 188

def reference
  @reference
end

#typeObject (readonly)

Returns the value of attribute type.



188
189
190
# File 'lib/hqmf-parser/2.0/types.rb', line 188

def type
  @type
end

Instance Method Details

#to_modelObject



200
201
202
203
# File 'lib/hqmf-parser/2.0/types.rb', line 200

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