Sha256: d7e2708822ad102fb5335e481a1f31a60779fb58094fa6a4236a0b3089dfa094

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

# Writer - internal data structure to FGDC CSDGM FGDC-STD-001-1998

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

require 'builder'
require_relative 'version'
require_relative 'classes/class_fgdc'

module ADIWG
   module Mdtranslator
      module Writers
         module Fgdc

            def self.startWriter(intObj, responseObj, whichDict: 0)

               # make contacts and domains available to the instance
               @contacts = intObj[:contacts]

               # set the format of the output file based on the writer
               responseObj[:writerOutputFormat] = 'xml'
               responseObj[:writerVersion] = ADIWG::Mdtranslator::Writers::Fgdc::VERSION

               # create new XML document
               xml = Builder::XmlMarkup.new(indent: 3)

               # start writing the FGDC XML record
               metadataWriter = Fgdc.new(xml, responseObj)
               metadata = metadataWriter.writeXML(intObj)

               return metadata

            end

            # find contact and return the contact hash
            def self.get_contact(contactId)
               @contacts.each do |contact|
                  if contact[:contactId] == contactId
                     return contact
                  end
               end
               return {}
            end

         end
      end
   end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.6.1 lib/adiwg/mdtranslator/writers/fgdc/fgdc_writer.rb