class SwaggerDocsGenerator::ModelMongo

Parse Mongo model

Constants

NAME
TYPES

Public Class Methods

new(model) click to toggle source
# File lib/swagger_docs_generator/models/mongo.rb, line 27
def initialize(model)
  @model = eval(model)
end

Public Instance Methods

attribute_properties() click to toggle source
# 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

Private Instance Methods

attribute_propertie(name) click to toggle source
# File lib/swagger_docs_generator/models/mongo.rb, line 41
def attribute_propertie(name)
  {
    name => TYPES.fetch(@model.fields[name].type.to_s)
  }
end