Class: U3d::DownloadValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/u3d/download_validator.rb

Direct Known Subclasses

LinuxValidator, MacValidator, WindowsValidator

Instance Method Summary collapse

Instance Method Details

#hash_validation(expected: nil, actual: nil) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# 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) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
# 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