Module: Adiwg_TimePeriod

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

Class Method Summary collapse

Class Method Details

.unpack(hTimePeriod) ⇒ Object



12
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
47
48
49
50
51
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_timePeriod.rb', line 12

def self.unpack(hTimePeriod)

  # instance classes needed in script
  intMetadataClass = .new

  # time period
  intTimePer = intMetadataClass.newTimePeriod

  if hTimePeriod.has_key?('id')
    s = hTimePeriod['id']
    if s != ''
      intTimePer[:timeID] = s
    end
  end

  if hTimePeriod.has_key?('description')
    s = hTimePeriod['description']
    if s != ''
      intTimePer[:description] = s
    end
  end

  if hTimePeriod.has_key?('beginPosition')
    s = hTimePeriod['beginPosition']
    if s != ''
      intTimePer[:beginTime] = Adiwg_DateTime.unpack(s)

    end
  end

  if hTimePeriod.has_key?('endPosition')
    s = hTimePeriod['endPosition']
    if s != ''
      intTimePer[:endTime] = Adiwg_DateTime.unpack(s)

    end
  end

  return intTimePer
end