Sha256: b9528b2fe1cf6e76539ac2cffd11b660f63cf8ec688b4e59544bcee3ad3366a4

Contents?: true

Size: 1.88 KB

Versions: 6

Compression:

Stored size: 1.88 KB

Contents

# ISO <<Class>> Date, DateTime
# 19115-3 writer output in XML

# History:
# 	Stan Smith 2019-03-14 original script

module ADIWG
   module Mdtranslator
      module Writers
         module Iso19115_3

            class GcoDateTime

               def initialize(xml, hResponseObj)
                  @xml = xml
                  @hResponseObj = hResponseObj
               end

               def writeXML(hDate)

                  date = hDate[:date]
                  dateRes = hDate[:dateResolution]

                  # date - date (required)
                  unless date.nil?
                     case dateRes
                        when 'Y'
                           dateStr = AdiwgDateTimeFun.stringDateFromDateTime(date, 'Y')
                           @xml.tag!('gco:Date', dateStr)
                        when 'YM'
                           dateStr = AdiwgDateTimeFun.stringDateFromDateTime(date, 'YM')
                           @xml.tag!('gco:Date', dateStr)
                        when 'YMD'
                           dateStr = AdiwgDateTimeFun.stringDateFromDateTime(date, 'YMD')
                           @xml.tag!('gco:Date', dateStr)
                        when 'YMDh', 'YMDhm', 'YMDhms'
                           dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(date, 'YMDhms')
                           @xml.tag!('gco:DateTime', dateStr)
                        when 'YMDhZ', 'YMDhmZ', 'YMDhmsZ'
                           dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(date, 'YMDhmsZ')
                           @xml.tag!('gco:DateTime', dateStr)
                        else
                           dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(date, dateRes)
                           @xml.tag!('gco:DateTime', dateStr)
                     end
                  end

               end # write XML
            end # Date class

         end
      end
   end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.19.0.pre.beta.31 lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_gcoDateTime.rb
adiwg-mdtranslator-2.19.0.pre.beta.30 lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_gcoDateTime.rb
adiwg-mdtranslator-2.19.0.pre.beta.29 lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_gcoDateTime.rb
adiwg-mdtranslator-2.19.0.pre.beta.28 lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_gcoDateTime.rb
adiwg-mdtranslator-2.19.0.pre.beta.27 lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_gcoDateTime.rb
adiwg-mdtranslator-2.19.0.pre.beta.26 lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_gcoDateTime.rb