title: How does Object know about the const_get method?
body: <p>I was reading <a href="https://stackoverflow.com/questions/833125/find-classes-available-in-a-module">another question</a> with an <a href="https://stackoverflow.com/a/833179/2909897">answer</a> that mentions using the <code>Module#const_get</code> instance method to find a class in a module. For example:</p>
  
  <pre><code>module M
    class C
    end
  end
  
  p M.const_get 'C'
  #=&gt; M::C
  </code></pre>
  
  <p>I was curious about the <code>const_get</code> method so I used <code>ri</code> and found:</p>
  
  <pre class="lang-none prettyprint-override"><code>ri Module#const_get
  ...
  This method will recursively look up constant names if a namespaced
  class name is provided.  For example:
  
    module Foo; class Bar; end end
    Object.const_get 'Foo::Bar'
  ...
  </code></pre>
  
  <p>It seems like <code>Object::const_get</code> is a singleton method. Using it in our context works:</p>
  
  <pre><code>module M
    class C
    end
  end
  
  p Object.const_get 'M::C'
  #=&gt; M::C
  </code></pre>
  
  <p>But there's nothing documented about that singleton method:</p>
  
  <pre class="lang-none prettyprint-override"><code>ri Object::const_get
  Nothing known about Object::const_get
  ri Object.const_get
  Nothing known about Object.const_get
  </code></pre>
  
  <p>This confused me because I know a <code>Module</code> is an <code>Object</code> but an <code>Object</code> is not a <code>Module</code>:</p>
  
  <pre><code>Module.ancestors
  #=&gt; [Module, Object, Kernel, BasicObject]
  Object.ancestors
  #=&gt; [Object, Kernel, BasicObject]
  </code></pre>
  
  <p>Except then I used the <code>Object#is_a?</code> instance method to check and saw that I was wrong about that:</p>
  
  <pre><code>Module.is_a? Object
  #=&gt; true
  Object.is_a? Module
  #=&gt; true
  </code></pre>
  
  <p>What started as an innocent <code>ri</code> query has led me to be confused about the entire Ruby object model.</p>
  
  <ul>
  <li>Why does <code>Object.is_a? Module #=&gt; true</code> if <code>Module</code> is not in <code>Object</code>s ancestor chain?</li>
  <li>How does <code>Object</code> know about the <code>const_get</code> method?</li>
  </ul>