aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/lib
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2018-01-22 17:09:13 -0500
committerGeorge Claghorn <george@basecamp.com>2018-01-22 17:15:55 -0500
commit05b7b80bcaeeb0357cdb6143fbeca1b3c73b5fb9 (patch)
tree7096d4341f830ae9fe8e5338674818797c2e347f /activestorage/lib
parentb4a2575475d1e552a10850e9bd95ba2a0cf516a8 (diff)
downloadrails-05b7b80bcaeeb0357cdb6143fbeca1b3c73b5fb9.tar.gz
rails-05b7b80bcaeeb0357cdb6143fbeca1b3c73b5fb9.tar.bz2
rails-05b7b80bcaeeb0357cdb6143fbeca1b3c73b5fb9.zip
Add missing require
Diffstat (limited to 'activestorage/lib')
-rw-r--r--activestorage/lib/active_storage/downloading.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/activestorage/lib/active_storage/downloading.rb b/activestorage/lib/active_storage/downloading.rb
index a57fda49b4..295289c1e7 100644
--- a/activestorage/lib/active_storage/downloading.rb
+++ b/activestorage/lib/active_storage/downloading.rb
@@ -1,10 +1,12 @@
# frozen_string_literal: true
+require "tmpdir"
+
module ActiveStorage
module Downloading
private
# Opens a new tempfile in #tempdir and copies blob data into it. Yields the tempfile.
- def download_blob_to_tempfile # :doc:
+ def download_blob_to_tempfile #:doc:
Tempfile.open([ "ActiveStorage", blob.filename.extension_with_delimiter ], tempdir) do |file|
download_blob_to file
yield file
@@ -12,14 +14,14 @@ module ActiveStorage
end
# Efficiently downloads blob data into the given file.
- def download_blob_to(file) # :doc:
+ def download_blob_to(file) #:doc:
file.binmode
blob.download { |chunk| file.write(chunk) }
file.rewind
end
# Returns the directory in which tempfiles should be opened. Defaults to +Dir.tmpdir+.
- def tempdir # :doc:
+ def tempdir #:doc:
Dir.tmpdir
end
end