Sha256: 91bd96c170f489563006aead26d52dab5d322f12b66ca59424dd454e26ebfee6

Contents?: true

Size: 665 Bytes

Versions: 7

Compression:

Stored size: 665 Bytes

Contents

# frozen-string-literal: true

require "down/version"
require "down/chunked_io"
require "down/errors"
require "down/utils"

require "fileutils"

module Down
  class Backend
    def self.download(*args, &block)
      new.download(*args, &block)
    end

    def self.open(*args, &block)
      new.open(*args, &block)
    end

    private

    # If destination path is defined, move tempfile to the destination,
    # otherwise return the tempfile unchanged.
    def download_result(tempfile, destination)
      return tempfile unless destination

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

      nil
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
down-5.0.1 lib/down/backend.rb
down-5.0.0 lib/down/backend.rb
down-4.8.1 lib/down/backend.rb
down-4.8.0 lib/down/backend.rb
down-4.7.0 lib/down/backend.rb
down-4.6.1 lib/down/backend.rb
down-4.6.0 lib/down/backend.rb