Sha256: 4dff77872d1a2b00c417eb577cfa5b57e5c8199b244db680ab152eef17199952
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
# frozen_string_literal: true module SwaggerDocsGenerator # # Metadata generated # # @abstract # Abstract class for metadata provide to controlloer in Rails application class MetadataController < Metadata def initialize @file_path = File.join(Dir.pwd, 'public', SwaggerDocsGenerator.configure_info.version) @conf = SwaggerDocsGenerator.configure.base_controller @controllers = case @conf when String then string_controller when Array then array_controller when Class then class_controller end end private attr_accessor :controllers, :file_path # :reek:UtilityFunction def string_controller ApplicationController.subclasses end def array_controller array = [] @conf.map { |controller| array |= search_subclasses(controller) } array end def class_controller search_subclasses(@conf.subclasses) end # :reek:UtilityFunction def search_subclasses(controller) ctrl = controller.subclasses ctrl.count.zero? ? [controller] : ctrl end end end require 'swagger_docs_generator/metadata/path' require 'swagger_docs_generator/metadata/tag' require 'swagger_docs_generator/metadata/definition'
Version data entries
3 entries across 3 versions & 1 rubygems