Class: Whisper::Model::ZipURI

Inherits:
URI
  • Object
show all
Defined in:
lib/whisper/model/uri.rb

Instance Method Summary collapse

Methods inherited from URI

#initialize, #to_path

Constructor Details

This class inherits a constructor from Whisper::Model::URI

Instance Method Details

#cacheObject



134
135
136
137
138
139
140
141
142
# File 'lib/whisper/model/uri.rb', line 134

def cache
  zip_path = super
  dest = unzipped_path
  return if dest.exist? && dest.mtime >= zip_path.mtime
  escaping dest do
    system "unzip", "-q", "-d", zip_path.dirname.to_path, zip_path.to_path, exception: true
  end
  zip_path
end

#clear_cacheObject



144
145
146
147
# File 'lib/whisper/model/uri.rb', line 144

def clear_cache
  super
  unzipped_path.rmtree if unzipped_path.exist?
end