class U3d::DownloadValidator

Public Instance Methods

hash_validation(expected: nil, actual: nil) click to toggle source
# File lib/u3d/download_validator.rb, line 25
def hash_validation(expected: nil, actual: nil)
  if expected
    if expected != actual
      UI.verbose "Expected hash is #{expected}, file hash is #{actual}"
      UI.important 'File looks corrupted (wrong hash)'
      return false
    end
  else
    UI.verbose 'No hash validation available. File is assumed correct but may not be.'
  end
  true
end
size_validation(expected: nil, actual: nil) click to toggle source
# File lib/u3d/download_validator.rb, line 38
def size_validation(expected: nil, actual: nil)
  if expected
    if expected != actual
      UI.verbose "Expected size is #{expected}, file size is #{actual}"
      UI.important 'File looks corrupted (wrong size)'
      return false
    end
  else
    UI.verbose 'No size validation available. File is assumed correct but may not be.'
  end
  true
end