Class: SwaggerDocsGenerator::Actions::Schema

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger_docs_generator/parser/actions/schema.rb

Overview

Create object swagger Schema

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Schema

Returns a new instance of Schema.



7
8
9
10
11
# File 'lib/swagger_docs_generator/parser/actions/schema.rb', line 7

def initialize(&block)
  @definition = nil
  @type = 'array'
  instance_eval(&block) if block_given?
end

Instance Method Details

#to_hashObject



13
14
15
16
# File 'lib/swagger_docs_generator/parser/actions/schema.rb', line 13

def to_hash
  element = { type: @type }
  element.merge!(items: { '$ref': @definition })
end