Change path for require

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

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

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