From: Yamal Soueidan Date: 2007-04-02T00:15:37+09:00 Subject: Re: How to use standard library? ------=_Part_100139_20207288.1175440533739 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Yes I understand that its module now :) But how can I see its module, I can see this: Module URI::Escape Module URI::REGEXP Class URI::BadURIError Class URI::Error Class URI::FTP Class URI::Generic Class URI::HTTP Class URI::HTTPS Class URI::InvalidComponentError Class URI::InvalidURIError Class URI::LDAP Class URI::MailTo I thought I would use URI:HTTP ? Another little thing is it does not throw any exceptions as mentioned in the doc? On 4/1/07, Michael T. Richter wrote: > > On Sun, 2007-01-04 at 20:42 +0900, Jamal Soueidan wrote: > > I'm looking at URI classhttp://www.ruby-doc.org/stdlib/libdoc/uri/rdoc/index.html > The interface is somehow confusing? > I tried to writeurl = uri.newurl.parse!('http://www.test.com') > but this give me error that new does not exist? > > > To me it looks like "uri" doesn't exist: > > irb(main):007:0> require 'uri'=> trueirb(main):008:0> url = uri.newNameError: undefined local variable or method `uri' for main:Object from (irb):8 from /usr/lib/ruby/1.8/uri/http.rb:56 > > > Glancing at the page you posted, I see there that there is no object > called "uri" anywhere. There is a *module* called "URI" and it has a > parse method, but there isn't a class you can instantiate. What's returned > from that method (there also doesn't appear to be a "parse!" method anywhere > on that page) looks like it's one of the URI:: classes for each > specific protocol like URI::HTTP and the like. > > irb(main):009:0> URI.parse("http://www.booger.com")=> # > > > -- > *Michael T. Richter* (*GoogleTalk:* > ttmrichter@gmail.com) > *All really first class designers are both artists, engineers, and men of > a powerful and intolerant temper, quick to resist the least modification of > the plans, energetic in fighting the least infringement upon what they > regard as their own sphere of action. (Nevil Shute)* > > ------=_Part_100139_20207288.1175440533739--