CommonThread - Our Blog

Recent Articles

Ruby Load Path

Ruby Load Path

Written By: Anthony Crumley

November 16th, 2007

Within Ruby code you can access and modify the load path that determines where “require” and “load” look for files. $:, $-I, and $LOAD_PATH all refer to the array of load paths. Simply add or remove paths from the array and where Ruby looks for files will be changed. This can be helpful for adding Ruby libraries to the context of an application or framework. In irb on my computer 9 paths are in the load path. Surprisingly, in the Rails console for a bare bones application there are over 45 and for an application with several plugins there are more than 80 paths.

Leave a Reply