Class | RDoc::RDoc |
In: |
rdoc.rb
|
Parent: | Object |
Encapsulate the production of rdoc documentation. Basically you can use this as you would invoke rdoc from the command line:
rdoc = RDoc::RDoc.new rdoc.document(args)
where args is an array of strings, each corresponding to an argument you‘d give rdoc on the command line. See rdoc/rdoc.rb for details.
Generator | = | Struct.new(:file_name, :class_name, :key) | This is the list of output generators that we support | |
GENERATORS | = | {} |
Format up one or more files according to the given arguments. For simplicity, argv is an array of strings, equivalent to the strings that would be passed on the command line. (This isn‘t a coincidence, as we do pass in ARGV when running interactively). For a list of options, see rdoc/rdoc.rb. By default, output will be stored in a directory called doc below the current directory, so make sure you‘re somewhere writable before invoking.
Throws: RDocError on error
# File rdoc.rb, line 231 231: def document(argv) 232: 233: TopLevel::reset 234: 235: @stats = Stats.new 236: 237: options = Options.instance 238: options.parse(argv, GENERATORS) 239: 240: unless options.all_one_file 241: setup_output_dir(options.op_dir) 242: end 243: 244: file_info = parse_files(options) 245: 246: gen = options.generator 247: 248: $stderr.puts "\nGenerating #{gen.key.upcase}..." unless options.quiet 249: 250: require gen.file_name 251: 252: gen_class = Generators.const_get(gen.class_name) 253: 254: unless file_info.empty? 255: gen = gen_class.for(options) 256: 257: pwd = Dir.pwd 258: 259: Dir.chdir(options.op_dir) unless options.all_one_file 260: 261: begin 262: Diagram.new(file_info, options).draw if options.diagram 263: gen.generate(file_info) 264: ensure 265: Dir.chdir(pwd) 266: end 267: end 268: 269: unless options.quiet 270: puts 271: @stats.print 272: end 273: end