Class: SwaggerDocsGenerator::Actions::Schema
- Inherits:
-
Object
- Object
- SwaggerDocsGenerator::Actions::Schema
- Defined in:
- lib/swagger_docs_generator/parser/actions/schema.rb
Overview
Create object swagger Schema
Instance Method Summary collapse
-
#initialize(&block) ⇒ Schema
constructor
A new instance of Schema.
- #to_hash ⇒ Object
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_hash ⇒ Object
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 |