title: Why did I get "main.using is permitted only at toplevel" when I used a Refinement in IRB?
body: <p>I tried to use a Refinement in IRB (v0.9.6, Ruby 2.3.0):</p>
  
  <pre><code>module Foo
    refine Object do
      def foo() "foo" end
    end
  end
  
  using Foo # =&gt; RuntimeError: main.using is permitted only at toplevel
  </code></pre>
  
  <p>This is basically <a href="http://ruby-doc.org/core/doc/syntax/refinements_rdoc.html" rel="noreferrer">the exact setup from the documentation</a> (which results in the same error).</p>
  
  <p>What went wrong? How do I fix this?</p>