Class: Omnizip::Formats::Rar::Rar5::Models::RecoveryOptions

Inherits:
Lutaml::Model::Serializable
  • Object
show all
Defined in:
lib/omnizip/formats/rar/rar5/models/recovery_options.rb

Overview

Recovery (PAR2) options for RAR5 archives

This model configures PAR2 parity file generation for error correction and recovery of corrupted or missing archive data.

Examples:

Enable recovery with default settings

options = RecoveryOptions.new(enabled: true)

Custom redundancy percentage

options = RecoveryOptions.new(
  enabled: true,
  redundancy: 10  # 10% redundancy
)

Instance Method Summary collapse

Instance Method Details

#enabled?Boolean

Check if recovery is enabled

Returns:

  • (Boolean)

    true if enabled



55
56
57
# File 'lib/omnizip/formats/rar/rar5/models/recovery_options.rb', line 55

def enabled?
  enabled == true
end

#validate!Object

Validate options

Raises:

  • (ArgumentError)

    If validation fails



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/omnizip/formats/rar/rar5/models/recovery_options.rb', line 40

def validate!
  if redundancy.negative? || redundancy > 100
    raise ArgumentError,
          "Redundancy must be 0-100, got #{redundancy}"
  end

  if block_size <= 0 || (block_size % 4) != 0
    raise ArgumentError,
          "Block size must be positive and divisible by 4"
  end
end