title: Metaprogramming Ruby: Using a specific superclass constructor
body: <p>In Ruby I would like to use a specific constructor of a superclass in a subclass. I want to do it because I have manipulated the superclass constructor dynamically. The corresponding subclass is dynamically created too.</p>
  
  <p>I've already found a way to do it, but as I am not very familiar with Ruby Metaprogramming I wonder if there is a better way of doing it.</p>
  
  <p>The following are my classes and my current solution. Thanks for reading and thinking :)</p>
  
  <pre><code>class A &lt; Object
    def self.new *args
      super
      #doing things
    end
  end
  
  class B &lt; A
    def self.new *args
      #doing things
      return superclass.superclass.method(:new).unbind.bind(self).call(args)
    end
  end
  </code></pre>