Skip to content

Instantly share code, notes, and snippets.

@gregoriokusowski
Created March 9, 2011 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregoriokusowski/862051 to your computer and use it in GitHub Desktop.
Save gregoriokusowski/862051 to your computer and use it in GitHub Desktop.
A simple ruby downloader.
require "open-uri"
#Ex.: Download.from("www.blablabla.com/my_download.txt").to("my_downloaded_file.txt")
class Download
def initialize(source)
@source = source
end
def self.from(source)
self.new(source)
end
def to(dest)
writeOut = open(dest, "wb")
writeOut.write(open(@source).read).close
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment