[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

change path for require

Bu Mihai

6/28/2007 8:46:00 AM

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

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

1 Answer

F. Senault

6/28/2007 8:55:00 AM

0

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
--
Arithmetic comparisons: greater-than and less-than considered to be
judgemental and divisive. In the interests of inclusiveness, only
equality-tests will be permitted.
(Tanuki in the SDM, on politically-correct coding)