For tedious reasons to do with Hpricot, I need to write a function that is passed a URL, and returns the whole contents of the page as a single string.
I\'m close.
You can do the same without OpenURI:
require 'net/http' require 'uri' def open(url) Net::HTTP.get(URI.parse(url)) end page_content = open('http://www.google.com') puts page_content
Or, more succinctly:
Net::HTTP.get(URI.parse('http://www.google.com'))