Module: Adiwg_Source

Defined in:
lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_source.rb

Class Method Summary collapse

Class Method Details

.unpack(hSource) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_source.rb', line 13

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