title: load 'file.rb' versus require 'Module' in Ruby
body: <p>I am confused about the difference between <code>load 'file.rb'</code> and <code>require 'Module'</code>. At <a href="http://ruby.learncodethehardway.org/book/ex40.html" rel="nofollow noreferrer">Learn Ruby the Hard Way</a>, the example of how to use a module is set up with two files (<code>mystuff.rb</code> and <code>apple.rb</code>):</p>
  <p>mystuff.rb</p>
  <pre><code>module MyStuff
      def MyStuff.apple()
          puts &quot;I AM APPLES!&quot;
      end
  end
  </code></pre>
  <p>apple.rb</p>
  <pre><code>require 'mystuff'
  
  MyStuff.apple()
  </code></pre>
  <p>However, when I run <code>apple.rb</code>, either in the Sublime Text console, or with <code>ruby apple.rb</code>, I get a <code>Load Error</code>. I have also tried <code>require 'MyStuff'</code>, and <code>require 'mystuff.rb'</code>, but I still get the <code>Load Error</code>.</p>
  <p>So, I switched the first line of <code>apple.rb</code> to <code>load 'mystuff.rb'</code>, which allows it to run. However, if I edit <code>'mystuff.rb'</code> to be a definition of <code>class MyStuff</code> as opposed to a <code>module MyStuff</code>, there is no difference.</p>
  <p>For reference, the <code>Load Error</code> is:
  <code>/Users/David/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in </code>require': cannot load such file -- mystuff (LoadError)`</p>
  <p>I've peeked into <code>kernel_require.rb</code> and looked at the <code>require</code> definition, but since I'm a Ruby Nuby (indeed, a programming newbie), it was a little overwhelming. Since Learn Ruby the Hard Way hasn't been updated since 2012-10-05, there've probably been some syntax changes for modules. Yes?</p>