[Rubygems-developers] require_gem/autorequire vs require.

Jim Freeze rubygems at freeze.org
Wed Jun 1 09:00:40 EDT 2005


* Jim Weirich <jim at weirichhouse.org> [2005-05-31 08:24:36 -0400]:

> On Tuesday 31 May 2005 03:05 am, Eric Hodel wrote:
> > Which automatically finds RubyInline, adds it to $LOAD_PATH, and then
> > requires 'inline'.
> >
> > Instead, we could do this:
> >
> >    activate 'RubyInline', '= 3.2.2'
> >    require 'inline'
> >
> > activate would add RubyInline 3.2.2 to $LOAD_PATH, and require would
> > just DTRT.
> 
> 
> I think I like 'Gem.activate' for namespace reasons ... there currently exists 
> a method by that name in the library, but is used only internally as far as I 
> know and I think we can safely hijack its name.

I don't understand how you would use Gem.activate.
If I start a new app, what do I do? Something like?:

  require 'rubygems'
  Gem.activate('rake', '1.1.1')

I think I like the simple activate, or even activate_gem better.

    activate_gem 'RubyInline', '= 3.2.2'
    require 'inline'

-- 
Jim Freeze
Ruby: I can explain it to ya but I can't understand it fer ya.


More information about the Rubygems-developers mailing list