Class: Renalware::ZipArchive
- Inherits:
-
Object
- Object
- Renalware::ZipArchive
- Defined in:
- app/models/renalware/zip_archive.rb
Instance Method Summary collapse
-
#initialize(file) ⇒ ZipArchive
constructor
A new instance of ZipArchive.
- #rar_archive? ⇒ Boolean
- #unzip ⇒ Object
Constructor Details
#initialize(file) ⇒ ZipArchive
Returns a new instance of ZipArchive.
7 8 9 |
# File 'app/models/renalware/zip_archive.rb', line 7 def initialize(file) @file = Pathname.new(file) end |
Instance Method Details
#rar_archive? ⇒ Boolean
20 21 22 |
# File 'app/models/renalware/zip_archive.rb', line 20 def rar_archive? `file #{file}`.match? /RAR/ end |
#unzip ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/models/renalware/zip_archive.rb', line 11 def unzip # Create a tmp dir and ensure PG has access to it. Dir.mktmpdir do |dir| `chmod a+rX #{dir}` files = unzip_to_tmp_dir_and_return_pathames_array(dir) yield(files) end end |