Ruby's include path

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

Hi –

On Sat, 14 Oct 2006, Andrew L. wrote:

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

Outstanding, thanks!

Andy

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs