Sha256: 1ef15f01b1a00e1d336cbeb837b3059da127648d5bea90711e3a235602c959e5

Contents?: true

Size: 646 Bytes

Versions: 6

Compression:

Stored size: 646 Bytes

Contents

module Ddr::IngestTools::DdrRdrMigrator
  class LicenseMapper

    attr_reader :logger, :manifest

    LICENSE_MAP = { 'https://creativecommons.org/publicdomain/zero/1.0/' =>
                        'http://creativecommons.org/publicdomain/zero/1.0/' }

    def initialize(logger: nil, manifest:)
      @logger = logger || Logger.new(STDOUT)
      @manifest = manifest
    end

    def call
      map_licenses
      manifest
    end

    private

    def map_licenses
      manifest.each do |row|
        if LICENSE_MAP.keys.include?(row['license'])
          row['license'] = LICENSE_MAP[row['license']]
        end
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ddr-ingesttools-0.6.1 lib/ddr/ingesttools/ddr_rdr_migrator/license_mapper.rb
ddr-ingesttools-0.6.0 lib/ddr/ingesttools/ddr_rdr_migrator/license_mapper.rb
ddr-ingesttools-0.5.0 lib/ddr/ingesttools/ddr_rdr_migrator/license_mapper.rb
ddr-ingesttools-0.5.0.rc3 lib/ddr/ingesttools/ddr_rdr_migrator/license_mapper.rb
ddr-ingesttools-0.5.0.rc2 lib/ddr/ingesttools/ddr_rdr_migrator/license_mapper.rb
ddr-ingesttools-0.5.0.rc1 lib/ddr/ingesttools/ddr_rdr_migrator/license_mapper.rb