Sha256: 65fd9562f24068fcb219f2afe67c18098c03daaeddbe683e8c8071051117a82c

Contents?: true

Size: 708 Bytes

Versions: 2

Compression:

Stored size: 708 Bytes

Contents

# frozen_string_literal: true

module WeakSwaggerParameters
  module Model
    extend ActiveSupport::Concern

    module ClassMethods
      def add_to_doc_section(doc_section)
        @doc_sections ||= []
        @doc_sections << doc_section
      end

      def in_doc_section?(doc_section)
        (@doc_sections || []).include?(doc_section)
      end

      def model(&block)
        @wsp_node = WeakSwaggerParameters::Definitions::Model.new(docs_model_name, &block)
        @wsp_node.apply_docs(self)
      end

      def wsp_node
        @wsp_node
      end

      def docs_model_name
        name.split('::').join('_')
      end
    end

    included do
      include Swagger::Blocks
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
weak_swagger_parameters-0.6.0 lib/weak_swagger_parameters/model.rb
weak_swagger_parameters-0.5.0 lib/weak_swagger_parameters/model.rb