require "active_support/concern" module ApiRegulator module DSL extend ActiveSupport::Concern def self.included(base) base.extend(ClassMethods) end module ClassMethods def api(controller_class, action, description, &block) @api_definitions ||= [] api_definition = Api.new( controller_class, action.to_s, description, &block ) @api_definitions << api_definition end def api_definitions @api_definitions || [] end end end end