Accessing Kernel namespace from within classes...

Accessing Kernel namespace from within classes...

Post by Gabriel Dr » Tue, 02 Oct 2007 23:35:50


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 #<URI::Generic:0x2d3b9c URL:example.com> (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