class SimpleXml::TemporalReference
Attributes
range[R]
reference[R]
type[RW]
Public Class Methods
new(type, comparison, quantity, unit, reference)
click to toggle source
# File lib/model/types.rb, line 161 def initialize(type, comparison, quantity, unit, reference) @type = translate_type(type) @range = SimpleXml::Range.new(comparison, quantity, unit, 'IVL_PQ') if comparison @reference = Reference.new(reference.id) end
Public Instance Methods
to_model()
click to toggle source
# File lib/model/types.rb, line 188 def to_model rm = range ? range.to_model : nil HQMF::TemporalReference.new(type, reference.to_model, rm) end
translate_type(type)
click to toggle source
# File lib/model/types.rb, line 167 def translate_type(type) # todo: we now have SBDU type = 'SBE' if type == 'SBOD' type = 'EBE' if type == 'EBOD' # the above two lines are required for legacy tests type = 'EACW' if type == 'EAOCW' || type == 'EAEORECW' type = 'EACWS' if type == 'EAOCWSO' || type == 'EASORECWS' type = 'EBCW' if type == 'EBOCW' || type == 'EBEORECW' type = 'EBCWS' if type == 'EBOCWSO' || type == 'EBSORECWS' type = 'ECWS' if type == 'ECWSO' type = 'SACWE' if type == 'SAOCWEO' || type == 'SAEORSCWE' type = 'SACW' if type == 'SAOCW' || type == 'SASORSCW' type = 'SBCWE' if type == 'SBOCWEO' || type == 'SBEORSCWE' type = 'SBCW' if type == 'SBOCW' || type == 'SBSORSCW' type = 'SCWE' if type == 'SCWEO' type = 'OVERLAP' if type == 'Overlaps' || type == 'Overlap' raise "unknown temporal reference type #{type}" unless HQMF::TemporalReference::TYPES.include? type type end