title: Detecting that a method was not overridden
body: <p>Say, I have the following 2 classes:</p>
  
  <pre><code>class A
    def a_method
    end
  end
  
  class B &lt; A
  end
  </code></pre>
  
  <p>Is it possible to detect from within (an instance of) class B that method <code>a_method</code> is <em>only</em> defined in the superclass, thus not being overridden in B?</p>
  
  <p><strong>Update: the solution</strong></p>
  
  <p>While I have marked the answer of Chuck as "accepted", later Paolo Perrota made me realize that the solution can apparently be simpler, and it will probably work with earlier versions of Ruby, too.</p>
  
  <p>Detecting if "a_method" is overridden in B:</p>
  
  <pre><code>B.instance_methods(false).include?("a_method")
  </code></pre>
  
  <p>And for class methods we use <code>singleton_methods</code> similarly:</p>
  
  <pre><code>B.singleton_methods(false).include?("a_class_method")
  </code></pre>