Satya's blog - Custom library path in Ruby

Apr 08 2009 20:34 Custom library path in Ruby

To add a custom or additional library path to a Ruby program: $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'

This "unshifts" onto the LOAD_PATH list, the full path to the lib directory, relative to the current file (which is the ruby program). Current file's location is guven by calling dirname on __FILE__.

This was useful for me when I was trying to get railroad to run from my home directory. (Railroad is a utility to graph Ruby on Rails' model/controller relations, very useful, I recommend it.)

Tag: geeky ruby