title: ruby modules and classes same name in structure
body: <p>I have a folder structure like the following in one of my projects:</p>
  
  <ul>
  <li>lib
  <ul>
  <li>bar.rb</li>
  <li>bar
  <ul>
  <li>other_bar.rb</li>
  <li>another_bar.rb</li>
  <li>next_bar.rb</li>
  <li>...</li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p><strong>bar.rb</strong></p>
  
  <pre><code>require File.expand_path(File.dirname(__FILE__) + "/bar/other_bar.rb")
  
  class Bar
    puts "running BarBase"
  end
  </code></pre>
  
  <p><strong>bar/other_bar.rb</strong></p>
  
  <pre><code>module Bar
    class OtherBar
      puts "running module Bar with class OtherBar"
    end
  end
  </code></pre>
  
  <p>If I now run <code>ruby bar.rb</code> I get this:</p>
  
  <blockquote>
    <p>running module Bar with class OtherBar<br>
    bar.rb:3:in `': Bar is not a class (TypeError)</p>
  </blockquote>
  
  <p>I'd like to have a similar structure to a rails model inheritance structure. How can I fix this?  So far as I know ruby does not support this out of the box. Is there a workaround for such a situation?</p>