From: 7stud -- Date: 2008-01-28T19:08:06+09:00 Subject: Re: Extracting Data from a Webpage 7stud -- wrote: > > As with all ruby classes, new() creates an instance. Therefore, in the > code example I was wondering about: > >> puts Net::HTTP.new('www.google.com').get('/'). >> body[/(.*?)<.title>/i,1] > > new() creates an instance, which is being used to call get(), so the > version of get() being called is the instance method. Yet, the docs say > the get() instance method "Gets data from path on the connected-to > host". What connected to host? According to the docs on new() it says, > "This method does not open the TCP connection." > As far as I can tell, you should have to call start() on a Net::HTTP instance in order to open a connection, e.g.: str = Net::HTTP.new('www.google.com').start().get('/').body -- Posted via http://www.ruby-forum.com/.