module ADIWG::Mdtranslator::Readers::Fgdc::TimeInstant

Public Class Methods

unpack(xDateTime, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/readers/fgdc/modules/module_timeInstant.rb, line 20
def self.unpack(xDateTime, hResponseObj)

   # instance classes needed in script
   intMetadataClass = InternalMetadata.new
   hTimeInstant = intMetadataClass.newTimeInstant

   date = xDateTime.xpath('./caldate').text
   time = xDateTime.xpath('./time').text
   xGeoAge = xDateTime.xpath('./geolage')

   # time instant - date-time
   unless date.empty?
      hDateTime = DateTime.unpack(date, time, hResponseObj)
      unless hDateTime.nil?
         hTimeInstant[:timeInstant] = hDateTime
         return hTimeInstant
      end
   end

   # time instant - geological age
   unless xGeoAge.empty?
      hGeoAge = GeologicAge.unpack(xGeoAge, hResponseObj)
      unless hGeoAge.nil?
         hTimeInstant[:geologicAge] = hGeoAge
         return hTimeInstant
      end
   end

   return nil

end