-*- Ruby -*- URLopen 1999 by yoshidam
TODO: This module should be writen by Ruby instead of wget/lynx.
# 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
# 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