From: Jim Weirich Date: 2006-01-06T06:55:19+09:00 Subject: Re: require 101 Brian Buckley wrote: > Hello all, > > What does the return value of a require statement supposed to indicate? > My > understanding was that 'true' meant the required library got properly > loaded. > > When I open a new IRB session and type, say, "require 'builder'" I get a > false returned. > > require 'builder'' > => false > > However, it appears that the statement does in fact load the library > (the > new classes in the library become available, etc). Why is the statement > returning false (or how can I diagnose why) and is it something to be > concerned over? Because Builder has that stupid autorequire attribute set in its gem spec. When you require builder, RubyGems determines that builder isn't in your list of available libraries, so it activates the gem and automatically requires the file listed in the autorequire attribute (which happens to be builder). Then RubyGems allows your original require to take place, which requires the builder file again. But, since builder was already autorequired, this time it returns a false. Yes, this is a bug. Yes, it is fixed in the CVS head of RubyGems. This is one of the (many) reasons I now believe autorequire was a mistake. I should email the author of builder and encourage him to remove the autorequire in the gem spec. Wait, oh, nevermind. -- -- Jim Weirich -- Posted via http://www.ruby-forum.com/.