class ADIWG::Mdtranslator::Writers::Fgdc::MethodKeyword

Public Class Methods

new(xml, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb, line 17
def initialize(xml, hResponseObj)
   @xml = xml
   @hResponseObj = hResponseObj
   @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
end

Public Instance Methods

writeXML(aKeywords) click to toggle source
# File lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb, line 23
def writeXML(aKeywords)
   
   # method bio (methodid) - lineage method keywords (required)
   haveMethod = false
   aKeywords.each do |hKeySet|
      type = hKeySet[:keywordType]
      if type == 'method' || type == 'methodology'
         aKeywords = hKeySet[:keywords]
         hThesaurus = hKeySet[:thesaurus]
         thesaurusName = nil
         unless hThesaurus.empty?
            thesaurusName = hThesaurus[:title]
         end
         @xml.tag!('methodid') do
            unless thesaurusName.empty?
               @xml.tag!('methkt', thesaurusName)
            end
            if thesaurusName.empty?
               @NameSpace.issueWarning(221, 'methkt')
            end
            aKeywords.each do |hKeyword|
               keyword = hKeyword[:keyword]
               unless keyword.nil?
                  @xml.tag!('methkey', keyword)
                  haveMethod = true
               end
            end
         end
      end
   end
   unless haveMethod
      @NameSpace.issueWarning(220, nil)
   end

end