From: Samuel Sternhagen Date: 2010-08-09T15:46:55+09:00 Subject: Re: Need help passing variable to Net::HTTP Jes炭s Gabriel y Gal叩n wrote: > On Mon, Aug 9, 2010 at 4:18 AM, Samuel Sternhagen > wrote: >> I have used Net::HTTP like this: >> >> Net::HTTP.get 'google.com', '/index.html' >> >> I would like to pass it a variable instead. > > You already got your answer, but I wanted to point out that: > >> irb(main):001:0> require 'net/http' >> => true >> irb(main):002:0> url = String.new >> => "" > > You don't need to do this, since you are assigning a new value to the > url variable just below. You are creating an object that you don't use > at all. > >> irb(main):003:0> url = "'google.com', '/index.html'" >> => "'google.com', '/index.html'" > > Jesus. Thanks for the tip Jesus. I used to program in C so I have some bad habits. I just tried my code without creating all those objects and everything went fine. -- Posted via http://www.ruby-forum.com/.