Sha256: 26987c953af7d24f43faaf5be25de217942371e2f000f066428ae0373fcf52a1

Contents?: true

Size: 443 Bytes

Versions: 1

Compression:

Stored size: 443 Bytes

Contents

module Eff
  class Verifier
    class << self
      def check(file, checksum, hash_function)
        return unless File.exists?(file)
        function    = function_const_get(hash_function)
        file_digest = function.file(file).hexdigest
        file_digest == checksum
      end

    private
      def function_const_get(value)
        hash_function = value.to_s.upcase
        Digest.const_get(hash_function)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
eff-0.0.2 lib/eff/verifier.rb