Class: Omnizip::Formats::Rar::ArchiveVerifier::VerificationResult
- Inherits:
-
Object
- Object
- Omnizip::Formats::Rar::ArchiveVerifier::VerificationResult
- Defined in:
- lib/omnizip/formats/rar/archive_verifier.rb
Overview
Verification result
Instance Attribute Summary collapse
-
#corrupt_blocks ⇒ Object
Returns the value of attribute corrupt_blocks.
-
#corrupted_files ⇒ Object
Returns the value of attribute corrupted_files.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#files_corrupted ⇒ Object
Returns the value of attribute files_corrupted.
-
#files_ok ⇒ Object
Returns the value of attribute files_ok.
-
#files_total ⇒ Object
Returns the value of attribute files_total.
-
#recoverable ⇒ Object
Returns the value of attribute recoverable.
-
#recovery_available ⇒ Object
Returns the value of attribute recovery_available.
-
#valid ⇒ Object
Returns the value of attribute valid.
Instance Method Summary collapse
-
#can_repair? ⇒ Boolean
Check if corruption can be repaired.
-
#initialize ⇒ VerificationResult
constructor
A new instance of VerificationResult.
-
#summary ⇒ String
Get summary string.
-
#valid? ⇒ Boolean
Check if archive is valid.
Constructor Details
#initialize ⇒ VerificationResult
Returns a new instance of VerificationResult.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/omnizip/formats/rar/archive_verifier.rb', line 17 def initialize @valid = true @files_total = 0 @files_ok = 0 @files_corrupted = 0 @corrupted_files = [] @recoverable = false @corrupt_blocks = [] @recovery_available = false @errors = [] end |
Instance Attribute Details
#corrupt_blocks ⇒ Object
Returns the value of attribute corrupt_blocks.
13 14 15 |
# File 'lib/omnizip/formats/rar/archive_verifier.rb', line 13 def corrupt_blocks @corrupt_blocks end |
#corrupted_files ⇒ Object
Returns the value of attribute corrupted_files.
13 14 15 |
# File 'lib/omnizip/formats/rar/archive_verifier.rb', line 13 def corrupted_files @corrupted_files end |
#errors ⇒ Object
Returns the value of attribute errors.
13 14 15 |
# File 'lib/omnizip/formats/rar/archive_verifier.rb', line 13 def errors @errors end |
#files_corrupted ⇒ Object
Returns the value of attribute files_corrupted.
13 14 15 |
# File 'lib/omnizip/formats/rar/archive_verifier.rb', line 13 def files_corrupted @files_corrupted end |
#files_ok ⇒ Object
Returns the value of attribute files_ok.
13 14 15 |
# File 'lib/omnizip/formats/rar/archive_verifier.rb', line 13 def files_ok @files_ok end |
#files_total ⇒ Object
Returns the value of attribute files_total.
13 14 15 |
# File 'lib/omnizip/formats/rar/archive_verifier.rb', line 13 def files_total @files_total end |
#recoverable ⇒ Object
Returns the value of attribute recoverable.
13 14 15 |
# File 'lib/omnizip/formats/rar/archive_verifier.rb', line 13 def recoverable @recoverable end |
#recovery_available ⇒ Object
Returns the value of attribute recovery_available.
13 14 15 |
# File 'lib/omnizip/formats/rar/archive_verifier.rb', line 13 def recovery_available @recovery_available end |
#valid ⇒ Object
Returns the value of attribute valid.
13 14 15 |
# File 'lib/omnizip/formats/rar/archive_verifier.rb', line 13 def valid @valid end |
Instance Method Details
#can_repair? ⇒ Boolean
Check if corruption can be repaired
39 40 41 |
# File 'lib/omnizip/formats/rar/archive_verifier.rb', line 39 def can_repair? @recovery_available && @recoverable end |
#summary ⇒ String
Get summary string
46 47 48 49 50 51 52 53 54 |
# File 'lib/omnizip/formats/rar/archive_verifier.rb', line 46 def summary if valid? "Archive OK: #{@files_total} files verified" else msg = "Archive corrupted: #{@files_corrupted}/#{@files_total} files damaged" msg += " (repairable)" if can_repair? msg end end |
#valid? ⇒ Boolean
Check if archive is valid
32 33 34 |
# File 'lib/omnizip/formats/rar/archive_verifier.rb', line 32 def valid? @valid && @files_corrupted.zero? end |