Sha256: 2edca99ab2485b33329ff4a407ec1cb6d2d28a03bebd2456e05d73e4c02efb10

Contents?: true

Size: 491 Bytes

Versions: 3

Compression:

Stored size: 491 Bytes

Contents

module Ddr::IngestTools
  class ChecksumFile

    attr_reader :digests

    def initialize(checksum_filepath)
      @digests = digest_hash(checksum_filepath)
    end

    def digest(filepath)
      digests[filepath]
    end

    private

    def digest_hash(checksum_filepath)
      h = {}
      File.open(checksum_filepath, 'r') do |file|
        file.each_line do |line|
          digest, path = line.chomp.split
          h[path] = digest
        end
      end
      h
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ddr-ingesttools-0.3.0 lib/ddr/ingesttools/checksum_file.rb
ddr-ingesttools-0.2.1 lib/ddr/ingesttools/checksum_file.rb
ddr-ingesttools-0.2.0 lib/ddr/ingesttools/checksum_file.rb