Class: DiscourseEmojis::ZipProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/discourse_emojis/zip_processor.rb

Defined Under Namespace

Classes: DownloadError, ExtractionError

Class Method Summary collapse

Class Method Details

.with_extracted_files(url, &block) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/discourse_emojis/zip_processor.rb', line 15

def self.with_extracted_files(url, &block)
  zip_path = File.join(Dir.tmpdir, File.basename(url))
  extract_path = Dir.mktmpdir

  begin
    download(url, zip_path)
    extract(zip_path, extract_path)
    yield(extract_path)
  ensure
    cleanup([extract_path, zip_path])
  end
end