Class: ADIWG::Mdtranslator::Writers::Fgdc::MethodKeyword

Inherits:
Object
  • Object
show all
Defined in:
lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb

Instance Method Summary collapse

Constructor Details

#initialize(xml, hResponseObj) ⇒ MethodKeyword

Returns a new instance of MethodKeyword.



17
18
19
20
21
# 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

Instance Method Details

#writeXML(aKeywords) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# 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