title: Can I detect that a method has been overridden?
body: <p>Suppose here's some arbitrary library code that I don't know about:</p>
  
  <pre><code>class Foo
    def hi
    end
  end
  
  class Bar &lt; Foo
    def hi
    end
  end
  </code></pre>
  
  <p>And suppose I have some code where I'm passed <code>Bar</code> as a parameter.</p>
  
  <pre><code>def check(x)
    do_something_with(x.method(:hi))
  end
  </code></pre>
  
  <p>In the above example, can I know that <code>x.hi</code> (where <code>x</code> references an instance of <code>Bar</code>) is different from <code>Foo#hi</code>?</p>
  
  <hr>
  
  <p>Based on Gareth's answer, this is what I've got so far:</p>
  
  <pre><code>def is_overridden?(method)
    name = method.name.to_sym
    return false if !method.owner.superclass.method_defined?(name)
    method.owner != method.owner.superclass.instance_method(name).owner
  end
  </code></pre>
  
  <p>Hideous? Gorgeous?</p>