1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add missing require

This commit is contained in:
George Claghorn 2018-01-22 17:09:13 -05:00
parent b4a2575475
commit 05b7b80bca

View file

@ -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