Class: ApiDoc

Inherits:
ApiClass show all
Defined in:
lib/tools/api_doc_generator.rb

Instance Attribute Summary collapse

Attributes inherited from ApiClass

#class_name, #description, #mhash, #model, #ruby_class, #xml_tag, #yard_class

Instance Method Summary collapse

Methods inherited from ApiClass

#categorize_members, class_hash=, #confluence_translate, #initialize, #instance_attributes_table, #method_documentation, #methods_documentation, rootpath=, #title, #xml_example, #xml_name_hash

Constructor Details

This class inherits a constructor from ApiClass

Instance Attribute Details

#classesObject

Returns the value of attribute classes.



284
285
286
# File 'lib/tools/api_doc_generator.rb', line 284

def classes
  @classes
end

#iosObject

Returns the value of attribute ios.



283
284
285
# File 'lib/tools/api_doc_generator.rb', line 283

def ios
  @ios
end

Instance Method Details

#classes_detailObject



311
312
313
314
315
316
317
# File 'lib/tools/api_doc_generator.rb', line 311

def classes_detail
  @classes.each do |cls|
    output cls.title
    output cls.description if cls != self
    output cls.methods_documentation
  end
end

#componentObject



298
299
300
301
# File 'lib/tools/api_doc_generator.rb', line 298

def component
  component = "h2. Component:  #{yard_class.name}\n"
  component
end

#output(string) ⇒ Object



336
337
338
# File 'lib/tools/api_doc_generator.rb', line 336

def output(string)
  @ios.puts  string
end

#parse_modelObject



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
# File 'lib/tools/api_doc_generator.rb', line 319

def parse_model
  @classes = Array.new
  @classes << self
  if @model
    model.lines.each do |line|
      matches = line.scan(/\[#(.*)?\]/)
      if matches.size > 0
        match = matches[0][0].split(/\]/)[0]
        if match != class_name
          @classes << ApiClass.new(match)
        end
      end
    end
  end

end

#process_doc(ios) ⇒ Object



286
287
288
289
290
291
292
293
294
295
296
# File 'lib/tools/api_doc_generator.rb', line 286

def process_doc(ios)
  @ios = ios
  parse_model

  output component
  output model
  output description
  output xml_example
  output xml_nodes
  classes_detail
end

#xml_nodesObject



303
304
305
306
307
308
309
# File 'lib/tools/api_doc_generator.rb', line 303

def xml_nodes
  nodes = "\nh4. XML Nodes\n"
  @classes.each do |cls|
    nodes << cls.instance_attributes_table(mode=:xml)
  end
  nodes
end