title: ruby method_alias in inherited class
body: <p>I'm deeping into ruby metaprogramming and have next question.
  Example:</p>
  
  <pre><code>module ExampleAliaser
    def do_example_alias(prefix=:origin)
  
      class_eval  &lt;&lt;-EOS
         class &lt;&lt; self 
             alias_method :#{prefix}_example, :example
             def example
                puts "in aliase will call :#{prefix}_example"
                #{prefix}_example
             end  
          end
      EOS
  
    end   
  end  
  
  class Example1
   def self.example
      puts "Example"
   end 
  end
  
  
  Example1.extend(ExampleAliaser)
  
  class Example1 
   do_example_alias(:origin)
  end
  class Example2 &lt;  Example1
   do_example_alias(:origin)
  end
  
  
  
       Example1.example
      in aliase will call :origin_example
      Example
       =&gt; nil 
  
       Example2.example
  in aliase will call :origin_example
  in aliase will call :origin_example
  in aliase will call :origin_example
      SystemStackError: stack level too deep
          from /Users/igorfedoronchuk/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/irb/workspace.rb:80
      Maybe IRB bug!!
  </code></pre>
  
  <p>So when mixin used 2 times it causes error.
  What is the best way to fix such things? How to determine that mixing exists and remove it before new mixing</p>