def download_file(uri, *args, **options, &block)
      uri = uri.to_s
      dest_path = (args.first || ::File.basename(uri)).to_s

      unless uri =~ %r{^https?\://}
        copy_file(uri, dest_path, options)
        return
      end

      content = DownloadFile.new(uri, dest_path, options).call

      if block_given?
        content = (block.arity.nonzero? ? block[content] : block[])
      end

      create_file(dest_path, content, options)
    end
def download_file(uri, *args, **options, &block)
      uri = uri.to_s
      dest_path = (args.first || ::File.basename(uri)).to_s

      unless uri =~ %r{^https?\://}
        copy_file(uri, dest_path, options)
        return
      end

      content = DownloadFile.new(uri, dest_path, options).call

      if block_given?
        content = (block.arity.nonzero? ? block[content] : block[])
      end

      create_file(dest_path, content, options)
    end
Download the content from a given address and
 save at the given relative destination. If block
 is provided in place of destination, the content of
 of the uri is yielded.

 @param [String, Pathname] uri
   the URI address
 @param [String, Pathname] dest
   the relative path to save
 @param [Hash[Symbol]] options
 @param options [Symbol] :limit
   the limit of redirects

 @example
   download_file("https://gist.github.com/4701967",
                 "doc/benchmarks")

 @example
   download_file("https://gist.github.com/4701967") do |content|
     content.gsub("\n", " ")
   end

 @api public