Module: Adiwg_Metadata

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

Class Method Summary collapse

Class Method Details

.unpack(hMetadata) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_metadata.rb', line 25

def self.unpack()

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

	# metadata - metadataInfo
	# metadataInfo needs access to resourceInfo to check taxonomy
	if .has_key?('metadataInfo')
		[:metadataInfo] = Adiwg_MetadataInfo.unpack()
	end

	# metadata - resource identification info
	if .has_key?('resourceInfo')
		hResourceInfo = ['resourceInfo']
		[:resourceInfo] = Adiwg_ResourceInfo.unpack(hResourceInfo)
	end

	# metadata - distribution info
	if .has_key?('distributionInfo')
		aDistributors = ['distributionInfo']
		unless aDistributors.empty?
			aDistributors.each do |hDistributor|
				[:distributorInfo] << Adiwg_DistributionInfo.unpack(hDistributor)
			end
		end
	end

	# metadata - associated resources
	if .has_key?('associatedResource')
		aAssocRes = ['associatedResource']
		unless aAssocRes.empty?
			aAssocRes.each do |hAssocRes|
				[:associatedResources] << Adiwg_AssociatedResource.unpack(hAssocRes)
			end
		end
	end

	# metadata - additional documents
	if .has_key?('additionalDocumentation')
		aAddDocs = ['additionalDocumentation']
		unless aAddDocs.empty?
			aAddDocs.each do |hAddDoc|
				[:additionalDocuments] << Adiwg_AdditionalDocumentation.unpack(hAddDoc)
			end
		end
	end

	return 

end