title: Better way to turn a ruby class into a module than using refinements?
body: <p><a href="http://ruby-doc.org/core-2.0.0/Module.html#method-i-refine" rel="noreferrer"><code>Module#refine</code></a> method takes a class and a block and returns a refinement module, so I thought I could define:</p>
  
  <pre><code>class Class
    def include_refined(klass)
      _refinement = Module.new do
        include refine(klass) {
          yield if block_given?
        }
      end
      self.send :include, _refinement
    end
  end
  </code></pre>
  
  <p>and the following test passes</p>
  
  <pre><code>class Base
    def foo
      "foo"
    end
  end
  
  class Receiver
    include_refined(Base) {
      def foo
        "refined " + super
      end
    }
  end
  
  describe Receiver do
    it { should respond_to(:foo) }
    its(:foo) { should eq("refined foo") }
  end
  </code></pre>
  
  <p>So, using refinements, I can turn a class into a module, refine its behaviour on the fly, and include it in other classes.</p>
  
  <ul>
  <li>Is there a simpler way to turn a class into a module in Ruby (say in ruby &lt; 2)?</li>
  <li><p>In the C-implementation of <a href="https://github.com/ruby/ruby/blob/1c7f9073b018319fbea5ffe98d7264d4553aaec1/eval.c#L1196" rel="noreferrer">rb_mod_refine</a>
  we see</p>
  
  <pre><code>refinement = rb_module_new();
  RCLASS_SET_SUPER(refinement, klass);
  </code></pre>
  
  <p>Is this just setting the superclass of refinement to <code>klass</code> that copies the implementation of the class inside the refinement module?</p></li>
  <li>I am aware that multiple inheritance IS
  done via Modules, but what would the community think of the above <code>Class#include_refined</code>?
  Would it be reasonable to extract this aspect out of refinements?
  "Locally" patching inside a Class instead of using "using" switches to activate refinements? </li>
  </ul>