Sha256: 227b60be4a75fa0684c76f4ed6fb0186459a34c866b6b59f1f322cf72d1f687d

Contents?: true

Size: 1.82 KB

Versions: 6

Compression:

Stored size: 1.82 KB

Contents

# FGDC <<Class>> MethodKeyword
# FGDC CSDGM writer output in XML

# History:
#  Stan Smith 2017-12-20 original script

module ADIWG
   module Mdtranslator
      module Writers
         module Fgdc

            class MethodKeyword

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

               def writeXML(aKeywords)

                  # method bio (methodid) - lineage method keywords (required)
                  haveMethod = false
                  aKeywords.each do |hKeySet|
                     type = hKeySet[:keywordType]
                     if type == 'method'
                        aKeywords = hKeySet[:keywords]
                        thesaurus = hKeySet[:thesaurus]
                        if thesaurus.empty?
                           @hResponseObj[:writerPass] = false
                           @hResponseObj[:writerMessages] << 'Lineage Method Keyword Set is missing thesaurus'
                        end
                        @xml.tag!('methodid') do
                           @xml.tag!('methkt', thesaurus[:title])
                           aKeywords.each do |hKeyword|
                              keyword = hKeyword[:keyword]
                              unless keyword.nil?
                                 @xml.tag!('methkey', keyword)
                                 haveMethod = true
                              end
                           end
                        end
                     end
                  end
                  unless haveMethod
                     @hResponseObj[:writerPass] = false
                     @hResponseObj[:writerMessages] << 'Lineage Method is missing keyword set'
                  end

               end # writeXML
            end # MethodKeyword

         end
      end
   end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.10.0 lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb
adiwg-mdtranslator-2.9.2 lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb
adiwg-mdtranslator-2.9.1 lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb
adiwg-mdtranslator-2.9.0 lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb
adiwg-mdtranslator-2.8.0 lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb
adiwg-mdtranslator-2.7.0 lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb