Class: DS_InitiativeTypeCode

Inherits:
Object
  • Object
show all
Defined in:
lib/adiwg/mdtranslator/writers/iso19115_2/codelists/code_initiativeType.rb

Overview

from www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml History: Stan Smith 2014-05-21 original script

Stan Smith 2014-10-15 allow non-ISO codesNames to be rendered

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ DS_InitiativeTypeCode

Returns a new instance of DS_InitiativeTypeCode.



9
10
11
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/codelists/code_initiativeType.rb', line 9

def initialize(xml)
  @xml = xml
end

Instance Method Details

#writeXML(codeName) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/codelists/code_initiativeType.rb', line 13

def writeXML(codeName)
  case(codeName)
    when 'campaign' then codeID = '001'
    when 'collection' then codeID = '002'
    when 'exercise' then codeID = '003'
    when 'experiment' then codeID = '004'
    when 'investigation' then codeID = '005'
    else
      codeID = 'non-ISO codeName'
  end

  # write xml
  @xml.tag!('gmd:DS_InitiativeTypeCode',{:codeList=>'http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#DS_InitiativeTypeCode',
                     :codeListValue=>"#{codeName}",
                     :codeSpace=>"#{codeID}"})
end