Method: WGET.open
- Defined in:
- lib/wget.rb
.open(url, *rest) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/wget.rb', line 15 def open(url, *rest) raise TypeError.new("wrong argument type #{url.inspect}" + " (expected String)") if url.class != String if url =~ /^\/|^\./ || (url !~ /^http:|^ftp:/ && FileTest.exist?(url)) File::open(url, *rest) else ENV['http_proxy'] = PARAM['http_proxy'] if PARAM['http_proxy'] ENV['ftp_proxy'] = PARAM['ftp_proxy'] if PARAM['ftp_proxy'] IO::popen(PARAM['wget'] + ' ' + PARAM['opts'] + ' ' + url) end end |