Module: ActiveStorage::Downloading
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
Analyzer ,
Analyzer::ImageAnalyzer ,
ActiveStorage::Analyzer::NullAnalyzer,
Analyzer::VideoAnalyzer ,
Previewer ,
Previewer::MuPDFPreviewer ,
Previewer::PopplerPDFPreviewer ,
Previewer::VideoPreviewer
| |
Defined in: | activestorage/lib/active_storage/downloading.rb |
Instance Method Summary
-
#download_blob_to(file)
private
Efficiently downloads blob data into the given file.
-
#download_blob_to_tempfile
private
Opens a new tempfile in #tempdir and copies blob data into it.
-
#tempdir
private
Returns the directory in which tempfiles should be opened.
Instance Method Details
#download_blob_to(file) (private)
Efficiently downloads blob data into the given file.
# File 'activestorage/lib/active_storage/downloading.rb', line 27
def download_blob_to(file) #:doc: file.binmode blob.download { |chunk| file.write(chunk) } file.flush file.rewind end
#download_blob_to_tempfile (private)
Opens a new tempfile in #tempdir and copies blob data into it. Yields the tempfile.
# File 'activestorage/lib/active_storage/downloading.rb', line 9
def download_blob_to_tempfile #:doc: open_tempfile_for_blob do |file| download_blob_to file yield file end end
#tempdir (private)
Returns the directory in which tempfiles should be opened. Defaults to Dir.tmpdir
.
# File 'activestorage/lib/active_storage/downloading.rb', line 35
def tempdir #:doc: Dir.tmpdir end