aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/lib/active_storage/downloader.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activestorage/lib/active_storage/downloader.rb')
-rw-r--r--activestorage/lib/active_storage/downloader.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/activestorage/lib/active_storage/downloader.rb b/activestorage/lib/active_storage/downloader.rb
index 7f5b4936a5..0e7039e104 100644
--- a/activestorage/lib/active_storage/downloader.rb
+++ b/activestorage/lib/active_storage/downloader.rb
@@ -1,9 +1,10 @@
# frozen_string_literal: true
module ActiveStorage
- class Downloader
- def initialize(blob)
- @blob = blob
+ class Downloader #:nodoc:
+ def initialize(blob, tempdir: nil)
+ @blob = blob
+ @tempdir = tempdir
end
def download_blob_to_tempfile
@@ -14,10 +15,10 @@ module ActiveStorage
end
private
- attr_reader :blob
+ attr_reader :blob, :tempdir
def open_tempfile
- file = Tempfile.open([ "ActiveStorage", tempfile_extension_with_delimiter ])
+ file = Tempfile.open([ "ActiveStorage", tempfile_extension_with_delimiter ], tempdir)
begin
yield file