module ADIWG::Mdtranslator::Readers::Fgdc::Date

Public Class Methods

unpack(date, time, type, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/readers/fgdc/modules/module_date.rb, line 19
def self.unpack(date, time, type, hResponseObj)

   # instance classes needed in script
   intMetadataClass = InternalMetadata.new
   hDate = intMetadataClass.newDate

   if date.nil? || date == ''
      hResponseObj[:readerExecutionMessages] << 'ERROR: FGDC reader: date missing from dateType creation'
      hResponseObj[:readerExecutionPass] = false
      return nil
   end

   if type.nil? || type == ''
      hResponseObj[:readerExecutionMessages] << 'ERROR: FGDC reader: role missing from dateType creation'
      hResponseObj[:readerExecutionPass] = false
      return nil
   end

   hDateTime = DateTime.unpack(date, time, hResponseObj)

   # build internal date object
   unless hDateTime.nil?
      hDate[:date] = hDateTime[:dateTime]
      hDate[:dateResolution] = hDateTime[:dateResolution]
      hDate[:dateType] = type
      return hDate
   end

   return nil

end