Class: DocGenerator
- Inherits:
-
Object
- Object
- DocGenerator
- Defined in:
- lib/tools/api_doc_generator.rb
Instance Method Summary collapse
- #generate_docs(apis) ⇒ Object
- #get_class_hash ⇒ Object
-
#initialize(rootpath) ⇒ DocGenerator
constructor
A new instance of DocGenerator.
Constructor Details
#initialize(rootpath) ⇒ DocGenerator
Returns a new instance of DocGenerator.
345 346 347 |
# File 'lib/tools/api_doc_generator.rb', line 345 def initialize(rootpath) @rootpath = rootpath end |
Instance Method Details
#generate_docs(apis) ⇒ Object
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 |
# File 'lib/tools/api_doc_generator.rb', line 349 def generate_docs(apis) temp_pathname = Pathname(@rootpath).join('api', 'temp') ApiClass.class_hash = get_class_hash ApiClass.rootpath = @rootpath apis.each do |api_name| doc_pathname = temp_pathname.join(api_name + "_confluence.txt") doc_pathname.parent.mkpath #puts doc_pathname.to_s #unless doc_pathname.exist? begin @constructor_params = Array.new @indent = 0 ios = doc_pathname.open("w") api_doc = ApiDoc.new(api_name) api_doc.process_doc(ios) ensure ios.close end #end end end |
#get_class_hash ⇒ Object
371 372 373 374 375 376 377 378 379 380 |
# File 'lib/tools/api_doc_generator.rb', line 371 def get_class_hash() class_hash = Hash.new yardoc = File.join(@rootpath, '.yardoc') Registry.load!(yardoc) # loads all objects into memory class_array = Registry.all(:class) # Array class_array.each do |cls| class_hash[cls.name.to_s] = cls end class_hash end |