From: Matt White Date: 2007-10-02T00:10:06+09:00 Subject: Re: Accessing Kernel namespace from within classes... On Oct 1, 8:35 am, Gabriel Dragffy wrote: > Hi all > > Hoping someone could tell me the answer to the following. > > I have a class defined in a file: TestWebsite. The main program > requires the 'net/http' library and also the TestWebsite file. The > class "TestWebsite" contains several class methods that use things > such as "Net::HTTP.get_response()" however I get the following errors: > > /net/http.rb:380:in `get_response': undefined method `request_uri' > for # (NoMethodError) > from /opt/local/lib/ruby/1.8/net/http.rb:543:in `start' > from /opt/local/lib/ruby/1.8/net/http.rb:379:in `get_response' > from ./test_website.rb:10:in `test' > > It's my guess the the class methods aren't able to access the net/ > http library which is in the kernel namespace, if this is true then > what must I do to allow them access? > > Many thanks, > > Gabriel Are you using a complete URI or just part of one? For example, 'domain.com' is not a URI. Further: [root@server15 mwhite]# ruby -r uri -e 'p URI.parse("google.com").host' nil [root@server15 mwhite]# ruby -r uri -e 'p URI.parse("http:// google.com").host' "google.com" If that's not the problem, maybe you could give us some code? Good luck! Matt