Sha256: 929db5b21dfb79484ee2bdfc6c7057d15c2f6fa199c6350f6409e2c83c4687d1

Contents?: true

Size: 1.2 KB

Versions: 6

Compression:

Stored size: 1.2 KB

Contents

# unpack source
# Reader - ADIwg JSON V1 to internal data structure

# History:
# 	Stan Smith 2013-11-26 original script
#   Stan Smith 2014-07-03 resolve require statements using Mdtranslator.reader_module

require ADIWG::Mdtranslator.reader_module('module_citation', $response[:readerVersionUsed])
require ADIWG::Mdtranslator.reader_module('module_processStep', $response[:readerVersionUsed])

module Adiwg_Source

	def self.unpack(hSource)

		# instance classes needed in script
		intMetadataClass = InternalMetadata.new
		intDataSource = intMetadataClass.newDataSource

		# source - description
		if hSource.has_key?('description')
			s = hSource['description']
			if s != ''
				intDataSource[:sourceDescription] = s
			end
		end

		# source - citation
		if hSource.has_key?('citation')
			hCitation = hSource['citation']
			unless hCitation.empty?
				intDataSource[:sourceCitation] = Adiwg_Citation.unpack(hCitation)
			end
		end

		# source - data sources
		if hSource.has_key?('processStep')
			aSourceSteps = hSource['processStep']
			unless aSourceSteps.empty?
				aSourceSteps.each do |hStep|
					intDataSource[:sourceSteps] << Adiwg_ProcessStep.unpack(hStep)
				end
			end
		end

		return intDataSource
	end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
adiwg-mdtranslator-0.9.0 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_source.rb
adiwg-mdtranslator-0.8.6 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_source.rb
adiwg-mdtranslator-0.8.5 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_source.rb
adiwg-mdtranslator-0.8.2 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_source.rb
adiwg-mdtranslator-0.8.1 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_source.rb
adiwg-mdtranslator-0.8.0 lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.8.0/module_source.rb