lib/dl/dl.rb in dl-1.0.0 vs lib/dl/dl.rb in dl-1.1.0

- old
+ new

@@ -1,18 +1,24 @@ module Dl def self.download(url, raw = false) session = Patron::Session.new - puts "Downloading #{url}..." + output "Downloading #{url}..." response = session.get url if raw == true puts response.body else filename = response.url.split('/').pop - puts "Downloaded to file #{filename}!" + output "Downloaded to file #{filename}!" File.new(filename, 'w').write(response.body) end + end + + private + + def self.output(string) + puts string unless Dl::be_quiet == true end end