Module: ADIWG::Mdtranslator::Readers::Fgdc::TimeInstant

Defined in:
lib/adiwg/mdtranslator/readers/fgdc/modules/module_timeInstant.rb

Class Method Summary collapse

Class Method Details

.unpack(xDateTime, hResponseObj) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# 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