From: James Edward Gray II Date: 2007-04-02T20:54:24+09:00 Subject: Re: How to use standard library? On Apr 2, 2007, at 6:19 AM, Jamal Soueidan wrote: > Sebastian Hungerecker wrote: >> Jamal Soueidan wrote: >>>> * Query >>>> * Fragment >>> >>> url = URI::split(url) >>> p url.host >>> >>> This doesn't work, host method not found? >> >> Well, as you said, the split method returns an array. Arrays have no >> method >> called host, so that's what ruby tells you. >> You'd access the host with url[2] because it's the third element >> in the >> array. >> >> HTH, >> Sebastian > > Ok I got that, why not use hash then if they tell us you got that in > return? > > so it be more readable like this :D > > uri.host :D You don't need the split() method to get this syntax: >> require "uri" => false >> uri = URI.parse("http://www.ruby-lang.org") => # >> uri.host => "www.ruby-lang.org" James Edward Gray II