Brian,

Thanks for responding:

This code:

require 'rubygems'
require 'netaddr'
ipadd = NetAddr::CIDR.create("192.9.200.0/24")

gives: 

/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require': no such file to load -- netaddr (LoadError)
        from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
        from ci.rb:2

This code:

require 'rubygems'
require 'net_addr'
ipadd = NetAddr::CIDR.create("192.9.200.0/24")

works.

Now, how am I supposed to learn the right string to put into the require
call.  The command to install was:

gem install netaddr


I don't remember why I guessed 'net_addr'


John


Brian Candler wrote:
> 
> On Fri, Apr 06, 2007 at 10:44:00AM +0900, John Franey wrote:
>> I want to use NetAddr 1.2 with gems 0.9.2 and ruby 1.8.5 on Suse 10.2.
>> The lines of code:
>> 
>> require 'rubygems'
>> gem 'netaddr'
>> ipadd = NetAddr::CIDR.create("192.9.200.0/24")
>> 
>> The error: uninitialized constant NetAddr (NameError)
>> 
>> 
>> This works:
>> 
>> require 'rubygems'
>> require_gem 'netaddr'
>> ipadd = NetAddr::CIDR.create("192.9.200.0/24")
>> 
>> But I get the warning: "require_gem is obsolete. Use gem instead."
> 
> Have you tried:
> 
> require 'rubygems'
> require 'netaddr'
> 
> ?
> (Newer versions of rubygems replace 'require' directly)
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/gem-and-uninitialized-constant-tf3534899.html#a9875785
Sent from the ruby-talk mailing list archive at Nabble.com.