Class: Imagemaster3000::Utils::Tmp
- Inherits:
-
Object
- Object
- Imagemaster3000::Utils::Tmp
- Defined in:
- lib/imagemaster3000/utils/tmp.rb
Class Method Summary collapse
Class Method Details
.destroy(file) ⇒ Object
17 18 19 20 21 |
# File 'lib/imagemaster3000/utils/tmp.rb', line 17 def self.destroy(file) logger.debug "Closing tempfile #{file.path.inspect}" file.close file.unlink end |
.download(url) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/imagemaster3000/utils/tmp.rb', line 7 def self.download(url) file = Tempfile.new('imagemaster3000') download = open(url) logger.debug "Downloading file from url #{url} to tempfile #{file.path.inspect}" IO.copy_stream(download, file) file.rewind file end |