Forum: Ruby RubyGems New gem() Method

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
James G. (Guest)
on 2007-02-28 00:52
(Received via mailing list)
Am I understanding right that the new gem() does not actually perform
the require?  It just sets up version handling, right?

Does this work for something like the soap4r gem?  You can't require
that gem normally, because the standard library will take
precedence.  In the past, require_gem() got around this but I'm
thinking we lost that trick.

Am I missing something?

James Edward G. II
Eric H. (Guest)
on 2007-02-28 01:15
(Received via mailing list)
On Feb 27, 2007, at 14:52, James Edward G. II wrote:
> Am I understanding right that the new gem() does not actually
> perform the require?  It just sets up version handling, right?

Kernel#gem adds the gem's require_paths to $:.

> Does this work for something like the soap4r gem?  You can't
> require that gem normally, because the standard library will take
> precedence.  In the past, require_gem() got around this but I'm
> thinking we lost that trick.

No, #gem doesn't do autorequire.  That's the only difference.

> Am I missing something?

Yes.  Use #gem.
James G. (Guest)
on 2007-02-28 01:21
(Received via mailing list)
On Feb 27, 2007, at 5:15 PM, Eric H. wrote:

> On Feb 27, 2007, at 14:52, James Edward G. II wrote:
>> Am I understanding right that the new gem() does not actually
>> perform the require?  It just sets up version handling, right?
>
> Kernel#gem adds the gem's require_paths to $:.

So gem prepends them to $:, so they will be found before the standard
libraries?  Good to know.

James Edward G. II
This topic is locked and can not be replied to.