Class: TestServer::ChecksumCalculator

Inherits:
Object
  • Object
show all
Defined in:
lib/test_server/checksum_calculator.rb

Direct Known Subclasses

MD5Calculator, Sha256Calculator

Instance Method Summary collapse

Instance Method Details

#use(file) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/test_server/checksum_calculator.rb', line 10

def use(file)
  file.checksum = compute_checksum(file)
rescue StandardError => err
  Rails.logger.error "#{err.class}: #{err.message}"
  
  checksum = OpenStruct.new
  checksum.value = "An error occured while determine checksum for \"#{file.name}\"."

  file.checksum = checksum
end