This doesn't explain how rubygems works at all.<p>For example, when you do<p><pre><code> require "some_gem"
</code></pre>
how does <i>require</i> know where to find <i>some_gem.<ext></i>?<p>First ruby looks in the current load path (i.e. <i>$:</i>). If it cannot find the file it then looks in your set of installed gems. If it finds a match it loads the file and adds that gem path to $:.<p><a href="http://ruby-doc.org/core-2.1.0/Kernel.html#method-i-require" rel="nofollow">http://ruby-doc.org/core-2.1.0/Kernel.html#method-i-require</a><p>(though those docs say nothing about checking the gem paths.)<p><i>This makes sense since if your project depends on a certain gem, who knows where you might reference it. Better load it as early as possible so its code can be used anywhere.</i><p>That's silly. If you are referencing gem code in a file then have that file require the needed gem. <i>require</i> will only load the file once so you can wait until you need a gem before you load it.<p>(<i>load</i>, OTOH, will reload a file as often as you call it).