class Down::Backend

Public Class Methods

download(*args, **options, &block) click to toggle source
# File lib/down/backend.rb, line 12
def self.download(*args, **options, &block)
  new.download(*args, **options, &block)
end
open(*args, **options, &block) click to toggle source
# File lib/down/backend.rb, line 16
def self.open(*args, **options, &block)
  new.open(*args, **options, &block)
end

Private Instance Methods

download_result(tempfile, destination) click to toggle source

If destination path is defined, move tempfile to the destination, otherwise return the tempfile unchanged.

# File lib/down/backend.rb, line 24
def download_result(tempfile, destination)
  return tempfile unless destination

  tempfile.close # required for Windows
  FileUtils.mv tempfile.path, destination

  nil
end