title: How can you influence the sequence in which Ruby code is loaded?
body: <p>Let's say your coworker monkeypatches the Fixnum class and redefines the + method to subtract instead of add:</p>
  
  <pre><code>class Fixnum
    def +(x)
      self - x
    end
  end
  
  &gt;&gt; 5 + 3
  =&gt; 2
  </code></pre>
  
  <p>Your problem is you want to access the original functionality of the + method. So you drop this code in before his in the same source file. It aliases the + method to "original_plus" <em>before</em> he monkeypatches it.</p>
  
  <pre><code>class Fixnum
    alias_method :original_plus, :+
  end
  
  class Fixnum
    def +(x)
      self - x
    end
  end
  </code></pre>
  
  <p>Now you can access the original functionality of the + method through original_plus</p>
  
  <pre><code>&gt;&gt; 5 + 3
  =&gt; 2
  &gt;&gt; 5.original_plus(3)
  =&gt; 8
  </code></pre>
  
  <p>But what I need to know is this: </p>
  
  <p><strong>Is there any other way of loading this alias BEFORE his monkeypatch loads besides sticking it into the same source file that he modified?</strong> </p>
  
  <p>There are two reasons for my question:</p>
  
  <ol>
  <li>I may not want him to know that I have done this</li>
  <li>If the source file is altered so that the alias ends up BELOW the monkeypatch, then the alias will no longer produce the desired result.</li>
  </ol>