Ruby Class Extension Mixin

module M
  def self.included(base)
    base.extend(ClassMethods)
  end

  module ClassMethods
    def my_method
      "class method"
      #code
    end
  end

  def test
    "instance method test"
  end

end

class C
  include M
end

C.my_method
a = C.new
a.test