Sha256: 4e5604be5c946e1bdd4442f2583fbf34ef4d87d5d237c4e73733d1ca93170e45

Contents?: true

Size: 1.42 KB

Versions: 18

Compression:

Stored size: 1.42 KB

Contents

# sbJson 1.0 writer

# History:
#  Stan Smith 2017-05-22 original script

require_relative 'sbJson_codelists'

module ADIWG
   module Mdtranslator
      module Writers
         module SbJson

            module Rights

               def self.build(aConstraints)

                  rights = ''

                  aConstraints.each do |hConstraint|
                     if hConstraint[:type] = 'legal'
                        unless hConstraint[:legalConstraint].empty?

                           # map legal constraint usage restriction codes
                           hConstraint[:legalConstraint][:useCodes].each do |code|
                              codeDef = Codelists.get_code_definition('iso_restriction', code)
                              unless codeDef.nil?
                                 rights += code + ' - ' + codeDef + '; '
                              end
                           end

                           # map other legal constraints
                           hConstraint[:legalConstraint][:otherCons].each do |con|
                              rights += con + '; '
                           end

                        end
                     end
                  end

                  # clean off last semicolon
                  if rights.length > 2
                     rights = rights[0...-2]
                  end

                  rights

               end

            end

         end
      end
   end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.8.0 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.7.0 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.6.1 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.6.0 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.5.0 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.4.0 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.3.5 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.3.4 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.3.3 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.3.2 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.3.1 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.3.0 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.2.0 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.1.2 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.1.1 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.1.0 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.0.0 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb
adiwg-mdtranslator-2.0.0rc13 lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_rights.rb