I want to add a folder ~/Projects/Scripts so I can use require script where script is a ruby file in this directory.
How does the require ruby method works? Does it load from a enviornment variable and if so what?
I want to add a folder ~/Projects/Scripts so I can use require script where script is a ruby file in this directory.
How does the require ruby method works? Does it load from a enviornment variable and if so what?
See this existing question. The answer is that you set the RUBYLIB environment variable to add items to the list of paths that Ruby searches.
$LOAD_PATH or $: or $-I is array of string holding the directories to be searched when load the files with the load or require methods. You can append new directories as you did for normal array.
>> $:
=> ["deleted_for_simplicity","/usr/lib/ruby/1.8/i386-linux", "."]
>> $: << "/opt/project"
=> ["deleted_for_simplicity","/usr/lib/ruby/1.8/i386-linux", ".", "/opt/project"]