title: Ruby give class variable include
body: <p>I am playing with modules and classes to get something done.</p>
  
  <p>When I fire up MyClass without any kind of inheritance I used <code>class MyClass::A4.generate</code>, where A4 overrides the format function.</p>
  
  <p>A4 looks like this:</p>
  
  <pre><code>class A4 &lt; MyClass
    def somefunction
      format = { :width =&gt; 200, :height =&gt; 100 }
    end
  end
  </code></pre>
  
  <p>But now I would want to create multiple classes (generating different kind of files) onto a couple of formats.</p>
  
  <p>My first attempt was a <code>class MyClass &lt; AnotherClass</code> but this is more some kind of trying Javacode in Ruby, well that's what a lot of people on internet say.</p>
  
  <p>Now the second attempt is a bit more Ruby like:</p>
  
  <pre><code>module AnotherModule
   def somefunction
     format = { :width =&gt; 50 }
   end
  end
  
  class MyClass
    include AnotherModule
    def initialize
    end
    ......
  end
  </code></pre>
  
  <p>Is something like this possible?</p>
  
  <pre><code>class A4 &lt; AnotherModule
    def somefunction
      format = { :width =&gt; 200, :height =&gt; 100 }
    end
  end
  
  MyClass::A4.new.generate
  </code></pre>
  
  <p>If so, how?</p>