Class: Longleaf::ManifestDigestProvider

Inherits:
Object
  • Object
show all
Defined in:
lib/longleaf/candidates/manifest_digest_provider.rb

Overview

Provides digests for files from a manifest

Instance Method Summary collapse

Constructor Details

#initialize(digests_mapping) ⇒ ManifestDigestProvider

Returns a new instance of ManifestDigestProvider.

Parameters:

  • digests_mapping

    hash which maps file paths to hashs of digests



5
6
7
# File 'lib/longleaf/candidates/manifest_digest_provider.rb', line 5

def initialize(digests_mapping)
  @digests_mapping = digests_mapping
end

Instance Method Details

#get_digests(file_path) ⇒ Object

Returns hash containing all the manifested digests for the given path, or nil.

Parameters:

  • file_path (String)

    path of file

Returns:

  • hash containing all the manifested digests for the given path, or nil



11
12
13
14
15
# File 'lib/longleaf/candidates/manifest_digest_provider.rb', line 11

def get_digests(file_path)
  # return nil if key not found, in case the hash has default values
  return nil unless @digests_mapping.key?(file_path)
  @digests_mapping[file_path]
end