Module: Adiwg_AssociatedResource

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

Class Method Summary collapse

Class Method Details

.unpack(hAssocRes) ⇒ Object



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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_associatedResource.rb', line 17

def self.unpack(hAssocRes)

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

	# associated resource - association type
	if hAssocRes.has_key?('associationType')
		s = hAssocRes['associationType']
		if s != ''
			intAssocRes[:associationType] = s
		end
	end

	# associated resource - initiative type
	if hAssocRes.has_key?('initiativeType')
		s = hAssocRes['initiativeType']
		if s != ''
			intAssocRes[:initiativeType] = s
		end
	end

	# associated resource - resource type
	if hAssocRes.has_key?('resourceType')
		s = hAssocRes['resourceType']
		if s != ''
			intAssocRes[:resourceType] = s
		end
	end

	# associated resource - resource citation
	if hAssocRes.has_key?('resourceCitation')
		hCitation = hAssocRes['resourceCitation']
		unless hCitation.empty?
			intAssocRes[:resourceCitation] = Adiwg_Citation.unpack(hCitation)
		end
	end

	# associated resource - metadata citation
	if hAssocRes.has_key?('metadataCitation')
		hCitation = hAssocRes['metadataCitation']
		unless hCitation.empty?
			intAssocRes[:metadataCitation] = Adiwg_Citation.unpack(hCitation)
		end
	end

	return intAssocRes
end