Method: Brief::Model::ClassMethods#to_documentation

Defined in:
lib/brief/model.rb

#to_documentationObject

Looks to see if there is a documentation markdown file for the model and if so, will return the documentation info as a Hash



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/brief/model.rb', line 133

def to_documentation
  docs = definition.documentation

  path = if docs.markdown
           Pathname(docs.markdown)
         elsif defined_in
           basename = defined_in.basename.to_s.gsub(/.rb/,'')
           defined_in.parent.join('..','documentation',"#{basename}.md")
         end

  if path
    model_doc = Brief::Briefcase::Documentation::ModelDoc.new(path)

    {
      content: model_doc.content,
      rendered: model_doc.rendered,
      path: path
    }
  else
    { }
  end
end