Ruby Programming/Standard Library/OpenURI

OpenURIEdit

OpenURI can be used to download a web page. Ex:

require 'open-uri'
   open("http://www.ruby-lang.org/") {|f|
     f.each_line {|line| p line}
   }

It appears to monkey patch the default "open" method for you, so that it is enhanced to take url's as well as its typical filenames etc.

See also Net::HTTP

Last modified on 27 July 2010, at 20:35