Sha256: f6fe8e0c817237115a50b5a6d59073f3a63a0fd32e879fdb05e7534d22c8b526

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

# :reek:Attribute
module SwaggerDocsGenerator
  # # Configuration to swagger json file
  #
  # This class it's a DSL class. For customize default json file.
  #
  # @example
  #   SwaggerDocsGenerator.configure do |config|
  #     config.swagger = '2.0.0'
  #   end
  #
  #   SwaggerDocsGenerator.config
  #   => #<SwaggerDocsGenerator::Configuration:0x007f8ae49138d8
  #    @swagger='2.0.0'>
  #
  # @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md
  class Configuration
    attr_accessor :swagger, :base_path, :schemes, :consumes, :produces,
                  :host, :paths, :definitions, :security_definitions,
                  :security, :tags, :external_docs, :base_controller

    SWAGGER = '2.0'

    # Initalize default value (and requried) for json swagger file
    def initialize
      @swagger = SWAGGER
      @base_controller = ''
    end
  end

  class << self
    def configure
      block_given? ? yield(config) : config
    end

    def config
      @config ||= Configuration.new
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
swagger_docs_generator-0.2.0.pre.10 lib/swagger_docs_generator/configuration/configuration.rb
swagger_docs_generator-0.2.0.pre.9 lib/swagger_docs_generator/configuration/configuration.rb
swagger_docs_generator-0.1.2 lib/swagger_docs_generator/configuration/configuration.rb
swagger_docs_generator-0.1.1 lib/swagger_docs_generator/configuration/configuration.rb