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.
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2007-02-27 23: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 Gray II
58479f76374a3ba3c69b9804163f39f4?d=identicon&s=25 Eric Hodel (Guest)
on 2007-02-28 00:15
(Received via mailing list)
On Feb 27, 2007, at 14:52, James Edward Gray 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.
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2007-02-28 00:21
(Received via mailing list)
On Feb 27, 2007, at 5:15 PM, Eric Hodel wrote:

> On Feb 27, 2007, at 14:52, James Edward Gray 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 Gray II
This topic is locked and can not be replied to.