Class: Omnizip::Formats::Rar::ArchiveRepairer::RepairResult
- Inherits:
-
Object
- Object
- Omnizip::Formats::Rar::ArchiveRepairer::RepairResult
- Defined in:
- lib/omnizip/formats/rar/archive_repairer.rb
Overview
Repair result
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#output_path ⇒ Object
Returns the value of attribute output_path.
-
#repaired_blocks ⇒ Object
Returns the value of attribute repaired_blocks.
-
#repaired_files ⇒ Object
Returns the value of attribute repaired_files.
-
#success ⇒ Object
Returns the value of attribute success.
-
#unrepaired_files ⇒ Object
Returns the value of attribute unrepaired_files.
Instance Method Summary collapse
-
#initialize ⇒ RepairResult
constructor
A new instance of RepairResult.
-
#success? ⇒ Boolean
Check if repair was successful.
-
#summary ⇒ String
Get repair summary.
Constructor Details
#initialize ⇒ RepairResult
Returns a new instance of RepairResult.
18 19 20 21 22 23 24 25 |
# File 'lib/omnizip/formats/rar/archive_repairer.rb', line 18 def initialize @success = false @repaired_files = [] @unrepaired_files = [] @repaired_blocks = [] @errors = [] @output_path = nil end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
15 16 17 |
# File 'lib/omnizip/formats/rar/archive_repairer.rb', line 15 def errors @errors end |
#output_path ⇒ Object
Returns the value of attribute output_path.
15 16 17 |
# File 'lib/omnizip/formats/rar/archive_repairer.rb', line 15 def output_path @output_path end |
#repaired_blocks ⇒ Object
Returns the value of attribute repaired_blocks.
15 16 17 |
# File 'lib/omnizip/formats/rar/archive_repairer.rb', line 15 def repaired_blocks @repaired_blocks end |
#repaired_files ⇒ Object
Returns the value of attribute repaired_files.
15 16 17 |
# File 'lib/omnizip/formats/rar/archive_repairer.rb', line 15 def repaired_files @repaired_files end |
#success ⇒ Object
Returns the value of attribute success.
15 16 17 |
# File 'lib/omnizip/formats/rar/archive_repairer.rb', line 15 def success @success end |
#unrepaired_files ⇒ Object
Returns the value of attribute unrepaired_files.
15 16 17 |
# File 'lib/omnizip/formats/rar/archive_repairer.rb', line 15 def unrepaired_files @unrepaired_files end |
Instance Method Details
#success? ⇒ Boolean
Check if repair was successful
30 31 32 |
# File 'lib/omnizip/formats/rar/archive_repairer.rb', line 30 def success? @success && @unrepaired_files.empty? end |
#summary ⇒ String
Get repair summary
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/omnizip/formats/rar/archive_repairer.rb', line 37 def summary if success? "Repair successful: #{@repaired_files.size} files, " \ "#{@repaired_blocks.size} blocks" elsif @repaired_files.any? "Partial repair: #{@repaired_files.size} files OK, " \ "#{@unrepaired_files.size} failed" else "Repair failed: #{@errors.join(', ')}" end end |