Brian B. wrote:
What does the return value of a require statement supposed to indicate?
understanding was that ‘true’ meant the required library got properly
When I open a new IRB session and type, say, “require ‘builder’” I get a
However, it appears that the statement does in fact load the library
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
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 W.