change path for require

M

mihai

how can i change the path for require?
for example my script is in C:\test and a have require 'watir' and i
want to add another require to a file wich is in
C:\test\tst\requiered_file.rb
 
F

F. Senault

Le 28 juin à 10:46, mihai a écrit :
how can i change the path for require?
for example my script is in C:\test and a have require 'watir' and i
want to add another require to a file wich is in
C:\test\tst\requiered_file.rb

Either :

require "tst/requiered_file.rb"

Or :

$LOAD_PATH << "c:/test/tst"
require "requiered_file.rb"

(Or any variations to find the path, but it's somewhat trickier with
relatives paths if you call your script from another directory.)

Fred
 

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

Forum statistics

Threads
474,262
Messages
2,571,310
Members
47,977
Latest member
MillaDowdy

Latest Threads

Top