title: Access class variables in a modules class and instance methods
body: <p>I have a module that contains both instance methods and class methods when included in a class. Both instance methods and class methods shall access class variables.</p>
  
  <pre><code>module MyModule
    @@a_class_variable = "lorem ipsum"
  
    def self.included(base)
      base.extend ClassMethods
    end
  
    module ClassMethods
      def a_class_method
        @@a_class_variable &lt;&lt; "abc"
      end
    end
  
    # Use it in constructor
    def initialize
      @@a_class_variable &lt;&lt; "abc"
    end
  
    def an_instance_method
      @@a_class_variable &lt;&lt; "abc"
    end
  end
  </code></pre>
  
  <p>When I include <code>MyModule</code> in some class, the interpreter says: <em>NameError: uninitialized class variable @@a_class_method in MyModule::ClassMethods</em></p>
  
  <p>What am I doing wrong?</p>