Created
March 9, 2011 11:26
-
-
Save gregoriokusowski/862051 to your computer and use it in GitHub Desktop.
A simple ruby downloader.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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