title: Why can't I call include from a class method in ruby?
body: <p>You can call include to mixin a module with a class in ruby, but it must be done at the beginning of the class definition. Why can't it be done inside a class function? Is there an alternate syntax?</p>
  
  <p>EX:</p>
  
  <pre><code>module UsefulThings
    def a() puts "a" end
  end
  
  class IncludeTester
    include UsefulThings
      def initialize
    end
  end
  
  n = IncludeTester.new
  n.a()
  </code></pre>
  
  <p>^^ This works, but if I change IncludeTester to the following, I get the error "undefined method `include'"</p>
  
  <pre><code>class IncludeTester
    def initialize
      include UsefulThings
    end
  end
  </code></pre>