title: Ruby path management
body: <p>What is the best way to manage the require paths in a ruby program?</p>
  
  <p>Let me give a basic example, consider a structure like:</p>
  
  <pre><code>\MyProgram
  
  \MyProgram\src\myclass.rb
  
  \MyProgram\test\mytest.rb
  </code></pre>
  
  <p>If in my test i use <code>require '../src/myclass'</code> then I can only call the test from <code>\MyProgram\test</code> folder, but I want to be able to call it from any path!</p>
  
  <p>The solution I came up with is to define in all source files the following line:</p>
  
  <p><code>ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(ROOT)</code> and then always use <code>require "#{ROOT}/src/myclass"</code></p>
  
  <p>Is there a better way to do it?</p>