title: How do I "require" into current scope?
body: <p>I'm not 100% sure how Ruby variable scope works, and I'm having trouble using the <code>require "path.rb"</code> statement. Here's a code snippet that is causing the problem:</p>
  
  <p>File a.rb:</p>
  
  <pre><code>a = {
          :hey =&gt; "ho"
      }
  
  require "path/to/b.rb" # =&gt; true
  </code></pre>
  
  <p>File b.rb:</p>
  
  <pre><code>b = "harhar"
  a[:test] = b
  </code></pre>
  
  <p>The scope of <code>a.rb</code> is inside a module::class, not the main global scope, and when I try and access the <code>a</code> variable within <code>b.rb</code> I get an error saying the <code>a</code> variable isn't in the current scope.</p>
  
  <p>I read somewhere about included files being in their own scope so as not to clash, if so, what is the convention for getting around this?</p>