Sha256: 81ceb7dce0aeda6ca69d86dde37dde7f741cf61397d9de567178e37314d5d767

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

# unpack time period
# Reader - ADIwg JSON V1 to internal data structure

# History:
# 	Stan Smith 2013-12-11 original script
#   Stan Smith 2014-07-07 resolve require statements using Mdtranslator.reader_module

require ADIWG::Mdtranslator.reader_module('module_dateTime', $response[:readerVersionUsed])

module Md_TimePeriod

	def self.unpack(hTimePeriod)

		# instance classes needed in script
		intMetadataClass = InternalMetadata.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] = Md_DateTime.unpack(s)

			end
		end

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

			end
		end

		return intTimePer
	end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adiwg-mdtranslator-0.10.2 lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_timePeriod.rb