class SwaggerDocsGenerator::ModelActiveRecord

Parse Active Record model

Constants

NAME
TYPES

Public Class Methods

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

Public Instance Methods

attribute_properties() click to toggle source
# File lib/swagger_docs_generator/models/active_record.rb, line 29
def attribute_properties
  propertie = {}
  @model.columns_hash.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/active_record.rb, line 39
def attribute_propertie(name)
  {
    name => TYPES[@model.columns_hash[name].type.to_s]
  }
end