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.



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

def classes
  @classes
end

#iosObject

Returns the value of attribute ios.



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

def ios
  @ios
end

Instance Method Details

#classes_detailObject



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

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

#componentObject



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

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

#output(string) ⇒ Object



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

def output(string)
  @ios.puts  string
end

#parse_modelObject



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

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



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

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



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

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