Sha256: 49a5567efba3790499ae3ec4f3b9107d9d42138943cf3e18f7c337311fd579d4

Contents?: true

Size: 976 Bytes

Versions: 2

Compression:

Stored size: 976 Bytes

Contents

require 'ostruct'

module Rswag3
  module Ui
    class Configuration
      attr_reader :template_locations
      attr_accessor :config_object
      attr_accessor :oauth_config_object
      attr_reader :assets_root

      def initialize
        @template_locations = [
          # preffered override location
          "#{Rack::Directory.new('').root}/swagger/index.erb",
          # backwards compatible override location
          "#{Rack::Directory.new('').root}/app/views/rswag3/ui/home/index.html.erb",
          # default location
          File.expand_path('../index.erb', __FILE__)
        ]
        @assets_root = File.expand_path('../../../../node_modules/swagger-ui-dist', __FILE__)
        @config_object = {}
        @oauth_config_object = {}
      end

      def swagger_endpoint(url, name)
        @config_object[:urls] ||= []
        @config_object[:urls] << { url: url, name: name }
      end

      def get_binding
        binding
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rswag3-ui-0.0.2 lib/rswag3/ui/configuration.rb
rswag3-ui-0.0.1 lib/rswag3/ui/configuration.rb