Include a class from other file in other folder

Suppose my script is in /home/mycode/here/
and a class 'Foo' is defined in /home/lib/foo.rb
how to include that?

is it possible using relative path like:
require '../../../lib/foo'?

···

--
Posted via http://www.ruby-forum.com/.

Hi,

you need "require_relative" for this (in Ruby 1.9). "require" is for
loading libraries that are in $LOAD_PATH.

···

--
Posted via http://www.ruby-forum.com/.

Jan E. wrote in post #1078236:

Hi,

you need "require_relative" for this (in Ruby 1.9). "require" is for
loading libraries that are in $LOAD_PATH.

I am using ruby 1.8.7
There is so simple using any file inside the folder or inside a folder
in the current directory..
I doubt there should be some simpler way!

···

--
Posted via http://www.ruby-forum.com/\.