title: Rename overlapping methods, added by observable, without affecting the others
body: <p>There's an <code>ActiveRecord</code> model, which has it's own (basically, included from the other ActiveRecord's module) <code>#changed?</code> and <code>#change</code> methods. And there's a module <code>Observable</code> which also has it's own <code>changed?</code> and <code>change</code> definitions.</p>
  
  <p>I need to define a custom module, which automatically includes <code>Observable</code> module and performs some underlying logic, but the problem is, that when I try to <code>alias</code> and <code>undef</code> original <code>Observable</code> method, it also <code>undefs</code> methods from other modules, which is critical.</p>
  
  <p>Is there any elegant way to solve this? As I don't really want to implemet a custom <code>Observable</code> module.</p>
  
  <p>Here's an example code:</p>
  
  <pre><code>require 'observer'
  
  # Trying to undef Observable's #changed and #changed?
  # But really, when included, it also undefs methods from
  # other modules included by original class
  module TryingToRewriteChanged
    include ::Observable
  
    alias triggerable_changed? changed?
    alias triggerable_changed changed
  
    undef_method :changed?
    undef_method :changed
  end
  
  # Custom module which has some logic in .included
  module Triggerable
    def self.included(obj)
      obj.class_eval do
        include TryingToRewriteChanged
        # ... And other magic
      end
    end
  end
  
  # Mock for some ActiveRecord module with 
  # #changed and #changed? definitions
  module ActiveRecord
    module SomeActiveRecordModule
      def changed
        puts 'original changed'
      end
  
      def changed?
        puts 'original changed?'
      end
    end
  end
  
  # Mock for ActiveRecord::Base class
  module ActiveRecord
    class Base
      include SomeActiveRecordModule
    end
  end
  
  # Example model, which need to include Triggerable module
  class SomeModel &lt; ActiveRecord::Base
    include Triggerable
  end
  
  # ActiveRecord's #changed is no more available
  SomeModel.new.changed
  # -&gt; undefined method `changed'
  </code></pre>
  
  <p><a href="https://repl.it/repls/KeyQuickwittedAsiantrumpetfish" rel="nofollow noreferrer">https://repl.it/repls/KeyQuickwittedAsiantrumpetfish</a></p>
  
  <p>Thank you.</p>