Class: SwaggerDocsGenerator::ModelMongo
- Inherits:
-
Object
- Object
- SwaggerDocsGenerator::ModelMongo
- Defined in:
- lib/swagger_docs_generator/models/mongo.rb
Overview
# Parse Mongo model
Constant Summary collapse
- NAME =
:mongo- TYPES =
{ 'Array' => { type: 'string' }, 'BigDecimal' => { type: 'number', format: 'double' }, 'Mongoid::Boolean' => { type: 'boolean' }, 'Date' => { type: 'string', format: 'date' }, 'DateTime' => { type: 'string', format: 'date-time' }, 'Float' => { type: 'number', format: 'float' }, 'Hash' => { type: 'string' }, 'Integer' => { type: 'integer', format: 'int64' }, 'BSON::ObjectId' => { type: 'string' }, 'Object' => { type: 'string' }, 'BSON::Binary' => { type: 'string', format: 'binary' }, 'Range' => { type: 'string' }, 'String' => { type: 'string' }, 'Symbol' => { type: 'string' }, 'Time' => { type: 'string', format: 'date-time' }, 'TimeWithZone' => { type: 'string', format: 'date-time' } }.freeze
Instance Method Summary collapse
- #attribute_properties ⇒ Object
-
#initialize(model) ⇒ ModelMongo
constructor
A new instance of ModelMongo.
Constructor Details
#initialize(model) ⇒ ModelMongo
Returns a new instance of ModelMongo.
27 28 29 |
# File 'lib/swagger_docs_generator/models/mongo.rb', line 27 def initialize(model) @model = eval(model) end |
Instance Method Details
#attribute_properties ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/swagger_docs_generator/models/mongo.rb', line 31 def attribute_properties propertie = {} @model.fields.each do |name, _value| propertie.merge!(attribute_propertie(name)) end propertie end |