Monday, December 31, 2007

Ruby include path

This has been bothering me for some time, wanting to include paths that will be searched when I want to 'require' or 'load' some class in my project. It is not very nice to have to use a -I flag, but there are other ways.

Use of the $: global variable:
  • $:.push("/whatever")
Or the $LOAD_PATH variable:
  • $LOAD_PATH.unshift '/whatever'