Sha256: 1e315f70e73fa9b12b2cd86c62c83aaeddebb3976191565d3104c0b0ec600a33

Contents?: true

Size: 1.69 KB

Versions: 9

Compression:

Stored size: 1.69 KB

Contents

# ISO <<Class>> CI_Date
# 19115-2 writer output in XML

# History:
# 	Stan Smith 2017-11-02 original script

require_relative 'class_codelist'
require_relative 'class_gcoDateTime'

module ADIWG
   module Mdtranslator
      module Writers
         module Iso19110

            class CI_Date

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

               def writeXML(hDate)

                  # classes used
                  codelistClass = MD_Codelist.new(@xml, @hResponseObj)
                  gcoDateTimeClass = GcoDateTime.new(@xml, @hResponseObj)

                  date = hDate[:date]
                  dateType = hDate[:dateType]

                  @xml.tag!('gmd:CI_Date') do

                     # date - date (required)
                     unless date.nil?
                        @xml.tag!('gmd:date') do
                           gcoDateTimeClass.writeXML(hDate)
                        end
                     end
                     if date.nil?
                        @xml.tag!('gmd:date', {'gco:nilReason' => 'missing'})
                     end

                     # date - date type (required)
                     unless dateType.nil?
                        @xml.tag!('gmd:dateType') do
                           codelistClass.writeXML('gmd', 'iso_dateType', dateType)
                        end
                     end
                     if dateType.nil?
                        @xml.tag!('gmd:dateType', {'gco:nilReason' => 'missing'})
                     end

                  end # CI_Date tag
               end # write XML
            end # CI_Date class

         end
      end
   end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.10.0 lib/adiwg/mdtranslator/writers/iso19110/classes/class_date.rb
adiwg-mdtranslator-2.9.2 lib/adiwg/mdtranslator/writers/iso19110/classes/class_date.rb
adiwg-mdtranslator-2.9.1 lib/adiwg/mdtranslator/writers/iso19110/classes/class_date.rb
adiwg-mdtranslator-2.9.0 lib/adiwg/mdtranslator/writers/iso19110/classes/class_date.rb
adiwg-mdtranslator-2.8.0 lib/adiwg/mdtranslator/writers/iso19110/classes/class_date.rb
adiwg-mdtranslator-2.7.0 lib/adiwg/mdtranslator/writers/iso19110/classes/class_date.rb
adiwg-mdtranslator-2.6.1 lib/adiwg/mdtranslator/writers/iso19110/classes/class_date.rb
adiwg-mdtranslator-2.6.0 lib/adiwg/mdtranslator/writers/iso19110/classes/class_date.rb
adiwg-mdtranslator-2.5.0 lib/adiwg/mdtranslator/writers/iso19110/classes/class_date.rb