Class: Omnizip::Formats::Rar::ArchiveRepairer::RepairResult

Inherits:
Object
  • Object
show all
Defined in:
lib/omnizip/formats/rar/archive_repairer.rb

Overview

Repair result

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRepairResult

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

#errorsObject

Returns the value of attribute errors.



15
16
17
# File 'lib/omnizip/formats/rar/archive_repairer.rb', line 15

def errors
  @errors
end

#output_pathObject

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_blocksObject

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_filesObject

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

#successObject

Returns the value of attribute success.



15
16
17
# File 'lib/omnizip/formats/rar/archive_repairer.rb', line 15

def success
  @success
end

#unrepaired_filesObject

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

Returns:

  • (Boolean)

    true if all files repaired



30
31
32
# File 'lib/omnizip/formats/rar/archive_repairer.rb', line 30

def success?
  @success && @unrepaired_files.empty?
end

#summaryString

Get repair summary

Returns:

  • (String)

    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