title: Why the module `ClassMethods` defined and extended in the same namespace?
body: <p>I am trying to understand code from github <a href="https://github.com/peter-murach/github/blob/master/lib/github_api.rb#L15" rel="noreferrer">repo</a>. It's the main module of the gem to setup the client.</p>
  
  <pre><code>module Github
    # more code
    class &lt;&lt; self
      def included(base)
        base.extend ClassMethods # what would this be for?
      end
      def new(options = {}, &amp;block)
        Client.new(options, &amp;block)
      end
      def method_missing(method_name, *args, &amp;block)
        if new.respond_to?(method_name)
          new.send(method_name, *args, &amp;block)
        elsif configuration.respond_to?(method_name)
          Github.configuration.send(method_name, *args, &amp;block)
        else
          super
        end
      end
      def respond_to?(method_name, include_private = false)
        new.respond_to?(method_name, include_private) ||
        configuration.respond_to?(method_name) ||
        super(method_name, include_private)
      end
    end
  
    module ClassMethods
      def require_all(prefix, *libs)
        libs.each do |lib|
          require "#{File.join(prefix, lib)}"
        end
      end
      # more methods ...
    end
  
    extend ClassMethods
    require_all LIBDIR,
      'authorization',
      'validations',
      'normalizer',
      'parameter_filter',
      'api',
      'client',
      'pagination',
      'request',
      'response',
      'response_wrapper',
      'error',
      'mime_type',
      'page_links',
      'paged_request',
      'page_iterator',
      'params_hash'
  
  end
  </code></pre>
  
  <ol>
  <li>Why is <code>class &lt;&lt; self</code> and <code>module ClassMethods</code> used, and then extended instead of being included in the <code>class &lt;&lt; self</code> part?</li>
  <li>There is a class method <code>def included(base)</code>. This seems to add the class methods into a specific object. Why is it like this? It could relate to the functionality of the class, but I do not understand it.</li>
  </ol>