Sha256: 408efd0df5e4305732276bc17288ed0021271c5695b354e56b51b6b84748ddc8

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

# unpack legal constraint
# Reader - ADIwg JSON V1 to internal data structure

# History:
# 	Stan Smith 2013-11-14 original script
# 	Stan Smith 2013-11-27 modified to process a single legal constraint
#   Stan Smith 2014-04-28 modified attribute names to match json schema 0.3.0

module Md_LegalConstraints

	def self.unpack(hLegalCon)

		# instance classes needed in script
		intMetadataClass = InternalMetadata.new
		hIntCon = intMetadataClass.newLegalConstraint

		# legal constraint - access code
		if hLegalCon.has_key?('accessConstraint')
			aAccCodes = hLegalCon['accessConstraint']
			unless aAccCodes.empty?
				hIntCon[:accessCodes] = aAccCodes
			end
		end

		# legal constraint - use code
		if hLegalCon.has_key?('useConstraint')
			aUseCodes = hLegalCon['useConstraint']
			unless aUseCodes.empty?
				hIntCon[:useCodes] = aUseCodes
			end
		end

		# legal constraint - other constraints
		if hLegalCon.has_key?('otherConstraint')
			aOtherCons = hLegalCon['otherConstraint']
			unless aOtherCons.empty?
				hIntCon[:otherCons] = aOtherCons
			end
		end

		return hIntCon

	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_legalConstraint.rb