title: How do I get the parent's class name in Ruby
body: <p>Let assume I have a classes <code>A</code> and <code>B</code> where <code>B</code> inherits <code>A</code>. How do I print parent class name in <code>B</code></p>
  
  <pre><code>class A
  end
  
  class B &lt; A
  end
  </code></pre>
  
  <p>Some things I have tried</p>
  
  <pre><code>&gt;&gt; B.new.class #=&gt; B   #which is correct
  &gt;&gt; B.new.parent  #=&gt; Undefined method `parent`
  &gt;&gt; B.parent   #=&gt; Object
  &gt;&gt; B.parent.class #=&gt; Class
  </code></pre>
  
  <p>Thanks :)</p>