Module: Adiwg_ResourceIdentifier

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

Class Method Summary collapse

Class Method Details

.unpack(hResID) ⇒ Object



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
47
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_resourceIdentifier.rb', line 15

def self.unpack(hResID)

  # instance classes needed in script
  intMetadataClass = .new
  intResID = intMetadataClass.newResourceId

  # resource identifier - identifier
  if hResID.has_key?('identifier')
    s = hResID['identifier']
    if s != ''
      intResID[:identifier] = s
    end
  end

  # resource identifier - identifier type
  if hResID.has_key?('type')
    s = hResID['type']
    if s != ''
      intResID[:identifierType] = s
    end
  end

  # resource identifier - authority (expressed as a citation)
  if hResID.has_key?('authority')
    hCitation = hResID['authority']
    unless hCitation.empty?
      intResID[:identifierCitation] =  Adiwg_Citation.unpack(hCitation)
    end
  end

  return intResID

end