Sha256: 5ef46e66034980312e1d4497ef2287df6b6a849157cb1540ab2f922dcae40174

Contents?: true

Size: 551 Bytes

Versions: 7

Compression:

Stored size: 551 Bytes

Contents

require 'csv'

module Ddr::IngestTools::ManifestArkMinter
  class ManifestParser

    attr_reader :manifest_file_path

    ARK_HEADER = 'ark'

    def initialize(manifest_file_path)
      @manifest_file_path = manifest_file_path
    end

    def as_csv_table
      @csv_table ||= CSV.read(manifest_file_path, headers: true)
    end

    def arks_missing?
      arks.any? { |value| value.compact.empty? }
    end

    def headers
      as_csv_table.headers
    end

    private

    def arks
      as_csv_table.values_at(ARK_HEADER)
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ddr-ingesttools-0.6.1 lib/ddr/ingesttools/manifest_ark_minter/manifest_parser.rb
ddr-ingesttools-0.6.0 lib/ddr/ingesttools/manifest_ark_minter/manifest_parser.rb
ddr-ingesttools-0.5.0 lib/ddr/ingesttools/manifest_ark_minter/manifest_parser.rb
ddr-ingesttools-0.5.0.rc3 lib/ddr/ingesttools/manifest_ark_minter/manifest_parser.rb
ddr-ingesttools-0.5.0.rc2 lib/ddr/ingesttools/manifest_ark_minter/manifest_parser.rb
ddr-ingesttools-0.5.0.rc1 lib/ddr/ingesttools/manifest_ark_minter/manifest_parser.rb
ddr-ingesttools-0.4.0 lib/ddr/ingesttools/manifest_ark_minter/manifest_parser.rb