Path to Ruby Scripts
Ever wondered how to set the path to some Ruby scripts you have written, so you can use them using “require”? There is a very basic solution for this problem. You need to define a system variable called RUBYLIB and point it to the directory containing your Ruby scripts. Then in your script where you want to use the library or script you created, you can simply do a “require” with the name of the script.
e.g. Supposed you created a script chart.rb in /home/foo/ruby/mylib direcory. Now, you want to use this in the app.rb located in /home/foo/ruby/scripts. Here is how you can make it work in a Linux bash environment. You could very well do this in other environments as well with minimal modifications.
In your ~/.bash_profile
export RUBYLIB=$RUBYLIB:/home/foo/ruby/mylib
and then in the app.rb script:
require 'chart'
That’s it.












