Class: Renalware::ZipArchive

Inherits:
Object
  • Object
show all
Defined in:
app/models/renalware/zip_archive.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


18
19
20
# File 'app/models/renalware/zip_archive.rb', line 18

def rar_archive?
  `file #{file}`.match? /RAR/
end

#unzipObject



11
12
13
14
15
16
# File 'app/models/renalware/zip_archive.rb', line 11

def unzip
  Dir.mktmpdir(nil, Rails.root.join("tmp").to_s) do |dir|
    files = unzip_to_tmp_dir_and_return_pathames_array(dir)
    yield(files)
  end
end