def class_methods(&class_methods_module_definition)
      mod = const_defined?(:ClassMethods, false) ?
        const_get(:ClassMethods) :
        const_set(:ClassMethods, Module.new)

      mod.module_eval(&class_methods_module_definition)
    end
def class_methods(&class_methods_module_definition)
      mod = const_defined?(:ClassMethods, false) ?
        const_get(:ClassMethods) :
        const_set(:ClassMethods, Module.new)

      mod.module_eval(&class_methods_module_definition)
    end
Define class methods from given block.
 You can define private class methods as well.

   module Example
     extend ActiveSupport::Concern

     class_methods do
       def foo; puts 'foo'; end

       private
         def bar; puts 'bar'; end
     end
   end

   class Buzz
     include Example
   end

   Buzz.foo # => "foo"
   Buzz.bar # => private method 'bar' called for Buzz:Class(NoMethodError)