Method: Download::Object#start

Defined in:
lib/download.rb

#start(hash = {}) ⇒ Object

start the downloading process



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/download.rb', line 32

def start(hash={})

  set_multi(hash)

  File.delete(file_path) if File.exist?(file_path)
  File.open(file_path, 'wb') do |file_obj|
    Kernel.open(*[url,options].compact) do |fin|
      while (buf = fin.read(8192))
        file_obj << buf
      end
    end
  end

  return file_path

end