Class: Omnizip::Formats::Rar::Models::RarArchive
- Inherits:
-
Object
- Object
- Omnizip::Formats::Rar::Models::RarArchive
- Defined in:
- lib/omnizip/formats/rar/models/rar_archive.rb
Overview
Represents a RAR archive with metadata
Instance Attribute Summary collapse
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#compressed_size ⇒ Object
Returns the value of attribute compressed_size.
-
#entries ⇒ Object
Returns the value of attribute entries.
-
#flags ⇒ Object
Returns the value of attribute flags.
-
#has_recovery ⇒ Object
Returns the value of attribute has_recovery.
-
#is_multi_volume ⇒ Object
Returns the value of attribute is_multi_volume.
-
#path ⇒ Object
Returns the value of attribute path.
-
#recovery_files ⇒ Object
Returns the value of attribute recovery_files.
-
#recovery_percent ⇒ Object
Returns the value of attribute recovery_percent.
-
#total_size ⇒ Object
Returns the value of attribute total_size.
-
#version ⇒ Object
Returns the value of attribute version.
-
#volumes ⇒ Object
Returns the value of attribute volumes.
Instance Method Summary collapse
-
#entry_count ⇒ Integer
Get total number of entries.
-
#format_version ⇒ String
Get RAR format version string.
-
#has_recovery_records? ⇒ Boolean
Check if archive has recovery records.
-
#initialize(path) ⇒ RarArchive
constructor
Initialize RAR archive.
-
#multi_volume? ⇒ Boolean
Check if archive is multi-volume.
-
#recovery_file_paths ⇒ Array<String>
Get recovery file paths.
-
#total_volumes ⇒ Integer
Get total number of volumes.
Constructor Details
#initialize(path) ⇒ RarArchive
Initialize RAR archive
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 17 def initialize(path) @path = path @version = nil @flags = 0 @volumes = [] @entries = [] @total_size = 0 @compressed_size = 0 @is_multi_volume = false @comment = nil @has_recovery = false @recovery_percent = 0 @recovery_files = [] end |
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment.
9 10 11 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 9 def comment @comment end |
#compressed_size ⇒ Object
Returns the value of attribute compressed_size.
9 10 11 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 9 def compressed_size @compressed_size end |
#entries ⇒ Object
Returns the value of attribute entries.
9 10 11 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 9 def entries @entries end |
#flags ⇒ Object
Returns the value of attribute flags.
9 10 11 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 9 def flags @flags end |
#has_recovery ⇒ Object
Returns the value of attribute has_recovery.
9 10 11 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 9 def has_recovery @has_recovery end |
#is_multi_volume ⇒ Object
Returns the value of attribute is_multi_volume.
9 10 11 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 9 def is_multi_volume @is_multi_volume end |
#path ⇒ Object
Returns the value of attribute path.
9 10 11 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 9 def path @path end |
#recovery_files ⇒ Object
Returns the value of attribute recovery_files.
9 10 11 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 9 def recovery_files @recovery_files end |
#recovery_percent ⇒ Object
Returns the value of attribute recovery_percent.
9 10 11 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 9 def recovery_percent @recovery_percent end |
#total_size ⇒ Object
Returns the value of attribute total_size.
9 10 11 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 9 def total_size @total_size end |
#version ⇒ Object
Returns the value of attribute version.
9 10 11 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 9 def version @version end |
#volumes ⇒ Object
Returns the value of attribute volumes.
9 10 11 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 9 def volumes @volumes end |
Instance Method Details
#entry_count ⇒ Integer
Get total number of entries
70 71 72 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 70 def entry_count @entries.size end |
#format_version ⇒ String
Get RAR format version string
63 64 65 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 63 def format_version @version == 5 ? "RAR5" : "RAR4" end |
#has_recovery_records? ⇒ Boolean
Check if archive has recovery records
35 36 37 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 35 def has_recovery_records? @has_recovery || @recovery_files.any? end |
#multi_volume? ⇒ Boolean
Check if archive is multi-volume
49 50 51 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 49 def multi_volume? @is_multi_volume end |
#recovery_file_paths ⇒ Array<String>
Get recovery file paths
42 43 44 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 42 def recovery_file_paths @recovery_files end |
#total_volumes ⇒ Integer
Get total number of volumes
56 57 58 |
# File 'lib/omnizip/formats/rar/models/rar_archive.rb', line 56 def total_volumes @volumes.size end |