Class: CI_DateTypeCode

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

Overview

from www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml History: Stan Smith 2013-08-09 original script

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

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ CI_DateTypeCode

Returns a new instance of CI_DateTypeCode.



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

def initialize(xml)
  @xml = xml
end

Instance Method Details

#writeXML(codeName) ⇒ Object



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

def writeXML(codeName)
  case(codeName)
    when 'creation' then codeID = '001'
    when 'publication' then codeID = '002'
    when 'revision' then codeID = '003'
    else
      codeID = 'non-ISO codeName'
  end

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