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’?
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’?
Hi,
you need “require_relative” for this (in Ruby 1.9). “require” is for
loading libraries that are in $LOAD_PATH.
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!
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs