Ruby's include path

A

Andrew Libby

Greetings,

I'm searching for something equivilent to Perl's "use lib".
I can see that there is a -I parameter to ruby itself, but
that seems clumsy when there are many paths to be added to
the include path (is that what ruby even calls it?).

Thanks a bunch.

Andy
 
D

dblack

Hi --

Greetings,

I'm searching for something equivilent to Perl's "use lib". I can see that
there is a -I parameter to ruby itself, but that seems clumsy when there are
many paths to be added to the include path (is that what ruby even calls
it?).

It's called the load path, and it's stored in the global $: variable,
which is an array to which you can add:

$:.push("/whatever")

If you don't like $: you can also address it as $LOAD_PATH.


David

--
David A. Black | (e-mail address removed)
Author of "Ruby for Rails" [1] | Ruby/Rails training & consultancy [3]
DABlog (DAB's Weblog) [2] | Co-director, Ruby Central, Inc. [4]
[1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com
[2] http://dablog.rubypal.com | [4] http://www.rubycentral.org
 
A

Andrew Libby

Outstanding, thanks!

Andy





Hi --



It's called the load path, and it's stored in the global $: variable,
which is an array to which you can add:

$:.push("/whatever")

If you don't like $: you can also address it as $LOAD_PATH.


David
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,215
Messages
2,571,113
Members
47,709
Latest member
Demetrius2

Latest Threads

Top