Module: Adiwg_DescriptiveKeyword

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

Class Method Summary collapse

Class Method Details

.unpack(hDesKeyword) ⇒ 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_descriptiveKeyword.rb', line 15

def self.unpack(hDesKeyword)

  # instance classes needed in script
  intMetadataClass = .new
  intKeyword = intMetadataClass.newKeyword

  # descriptive keyword - keyword array
  if hDesKeyword.has_key?('keyword')
    aKeywords = hDesKeyword['keyword']
    aKeywords.each do |keyword|
      intKeyword[:keyword] << keyword
    end
  end

  # descriptive keyword - keyType
  if hDesKeyword.has_key?('keywordType')
    s = hDesKeyword['keywordType']
    if s != ''
      intKeyword[:keywordType] = s
    end
  end

  # descriptive keyword - thesaurus
  if hDesKeyword.has_key?('thesaurus')
    hCitation = hDesKeyword['thesaurus']
    unless hCitation.empty?
      intKeyword[:keyTheCitation] = Adiwg_Citation.unpack(hCitation)
    end

  end

  return intKeyword
end