module ADIWG::Mdtranslator::Readers::MdJson::GeologicAge
Public Class Methods
unpack(hGeoAge, responseObj, inContext = nil)
click to toggle source
# File lib/adiwg/mdtranslator/readers/mdJson/modules/module_geologicAge.rb, line 17 def self.unpack(hGeoAge, responseObj, inContext = nil) @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson # return nil object if input is empty if hGeoAge.empty? @MessagePath.issueWarning(350, responseObj, inContext) return nil end # instance classes needed in script intMetadataClass = InternalMetadata.new intGeoAge = intMetadataClass.newGeologicAge outContext = 'geologic age' outContext = inContext + ' > ' + outContext unless inContext.nil? # geologic age - time scale (required) if hGeoAge.has_key?('ageTimeScale') intGeoAge[:ageTimeScale] = hGeoAge['ageTimeScale'] end if intGeoAge[:ageTimeScale].nil? || intGeoAge[:ageTimeScale] == '' @MessagePath.issueError(351, responseObj, inContext) end # geologic age - age estimate (required) if hGeoAge.has_key?('ageEstimate') intGeoAge[:ageEstimate] = hGeoAge['ageEstimate'] end if intGeoAge[:ageEstimate].nil? || intGeoAge[:ageEstimate] == '' @MessagePath.issueError(352, responseObj, inContext) end # geologic age - age uncertainty if hGeoAge.has_key?('ageUncertainty') unless hGeoAge['ageUncertainty'] == '' intGeoAge[:ageUncertainty] = hGeoAge['ageUncertainty'] end end # geologic age - age explanation if hGeoAge.has_key?('ageExplanation') unless hGeoAge['ageExplanation'] == '' intGeoAge[:ageExplanation] = hGeoAge['ageExplanation'] end end # geologic age - age reference [] {citation} if hGeoAge.has_key?('ageReference') hGeoAge['ageReference'].each do |hCitation| unless hCitation.empty? hReturn = Citation.unpack(hCitation, responseObj, outContext) unless hReturn.nil? intGeoAge[:ageReferences] << hReturn end end end end return intGeoAge end