title: How can I use class instance variables in an extended module in Ruby?
body: <p>I want to create a DSL which stores various blocks, and then can call them. I want this to be a reusable module that I can include in multiple classes.</p>
  
  <p>I figured out a way to do this using class variables, but rubocop complains and says that I should use class instance variables instead. I can't figure out a way to do this though. Is it possible?</p>
  
  <pre><code>module MyModule
    def self.included(base)
      base.extend(ClassMethods)
    end
  
    def run_fixers
      ClassMethods.class_variable_get(:@@fixers).each(&amp;:call)
    end
  
    module ClassMethods
      def fix(_name, &amp;block)
        @@fixers ||= []
        @@fixers &lt;&lt; block
      end
    end
  end
  
  class MyClass
    include MyModule
  
    def initialize
      run_fixers
    end
  
    fix 'test' do
      puts 'testing'
    end
  end
  </code></pre>