Sha256: aa3cdf9057d3fead8d9d13648bbce35c91b1cadeb6441889d3276b58de34dc48

Contents?: true

Size: 861 Bytes

Versions: 3

Compression:

Stored size: 861 Bytes

Contents

# frozen_string_literal: true

module SwaggerDocsGenerator
  # # Parse classes
  #
  # @abstract Classes for parsing Rails classes
  #
  # @!attribute [r] controller
  #   It's a name of controller parsed
  # @!attribute [r] tag_name
  #   It's a tag attaching to controller
  class Parser
    attr_reader :controller, :tag_name

    def initialize(klass)
      @controller = klass::CONTROLLER
      @tag_name = defined?(klass::TAG) ? klass::TAG : controller_name
    end

    def temporary_file
      File.join(SwaggerDocsGenerator.temporary_folder, tmp_json)
    end

    private

    def controller_name
      @controller.controller_name
    end

    def tmp_json
      "#{@tag_name}.json"
    end
  end
end

require 'swagger_docs_generator/parser/controller'
require 'swagger_docs_generator/parser/action'
require 'swagger_docs_generator/parser/definition'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
swagger_docs_generator-0.3.1 lib/swagger_docs_generator/parser/parser.rb
swagger_docs_generator-0.3.0.pre.19 lib/swagger_docs_generator/parser/parser.rb
swagger_docs_generator-0.3.0.pre.18 lib/swagger_docs_generator/parser/parser.rb