Sha256: 873aa58e27927566e866fbedf16dfca4609c42e6ee87a68e2609b84fff2db1bd

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

module SwaggerDocsGenerator
  module Actions
    # # Test value in actions
    #
    # @abstract classes for all actions class
    # @see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#operation-object
    class Actions
      attr_reader :hash, :key

      def initialize(key)
        @key = key
        @hash = { @key => {} }
      end

      def hash
        @hash[@key] ? @hash : {}
      end

      # List to all childrens
      def self.descendants
        ObjectSpace.each_object(Class).select { |klass| klass < self }
      end

      private

      def complete_hash(data)
        raw ||= data[@key]
        @hash[@key] = raw
      end
    end
  end
end

require 'swagger_docs_generator/parser/actions/tags'
require 'swagger_docs_generator/parser/actions/summary'
require 'swagger_docs_generator/parser/actions/description'
require 'swagger_docs_generator/parser/actions/response'
require 'swagger_docs_generator/parser/actions/consumes'
require 'swagger_docs_generator/parser/actions/produces'
require 'swagger_docs_generator/parser/actions/parameters'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
swagger_docs_generator-0.1.1 lib/swagger_docs_generator/parser/actions/actions.rb
swagger_docs_generator-0.1.0 lib/swagger_docs_generator/parser/actions/actions.rb