Sha256: c783b03a0cfc9d32aa8a14fb210760ea3876de4605455425a769df9c3f067a1f

Contents?: true

Size: 807 Bytes

Versions: 1

Compression:

Stored size: 807 Bytes

Contents

module Apress
  module Documentation
    module Swagger
      class Schema
        include ::Swagger::Blocks

        class << self
          attr_accessor :resource, :document_slug, :schema_block
        end

        def self.schema_name(name)
          "#{self.name}::#{name.to_s.camelize}".to_sym
        end

        def self.swagger_classes
          @swagger_classes ||= []
        end

        def self.inherited(child)
          swagger_classes << child
        end

        module Extensions
          def swagger_path(*args, &block)
            self.resource = true
            super
          end

          def swagger_schema(*args, &block)
            self.schema_block = block
            super
          end
        end

        singleton_class.prepend Extensions
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
apress-documentation-0.4.0 lib/apress/documentation/swagger/schema.rb