From: David Garamond Date: 2004-11-21T14:30:12+09:00 Subject: Re: several questions on using gems Jim Weirich wrote: > On Saturday 20 November 2004 09:36 pm, David Garamond wrote: > >>but i wonder why rubygems doesn't hack Kernel#require to accept version >>requirements as well. that way i can forget all about Kernel#require_gem > > require works at a file level. require_gem works at a package level. There > is some confusion because (a) often packages often have the same name as > their main require file, and (b) rubygems allows you to specify a special > require file that is automatically required when the gem is loaded. > > The difference is important because they are used differently. Every file > that uses (for example) the Builder::XmlMarkup class should include > 'builder/xmlmarkup'. But the require_gem statement for builder should more > centralized. This is because you don't want to scatter explicit version > references throughout your code. It is better to keep them in one place > (more or less). > > At least that's my current thinking on the topic. well, can't the rubygem's Kernel#require hack detect that when the second (and third, ...) arguments are specified, then it's a gem require, not a file require? Regards, dave