| Class | Generators::XMLGenerator |
| In: |
rdoc/generators/xml_generator.rb
|
| Parent: | HTMLGenerator |
Generate XML output as one big file
Standard generator factory
# File rdoc/generators/xml_generator.rb, line 16 def XMLGenerator.for(options) XMLGenerator.new(options) end
# File rdoc/generators/xml_generator.rb, line 61 def build_class_list(from, html_file, class_dir) @classes << HtmlClass.new(from, html_file, class_dir, @options) from.each_classmodule do |mod| build_class_list(mod, html_file, class_dir) end end
Generate:
# File rdoc/generators/xml_generator.rb, line 50 def build_indices @info.each do |toplevel| @files << HtmlFile.new(toplevel, @options, FILE_DIR) end RDoc::TopLevel.all_classes_and_modules.each do |cls| build_class_list(cls, @files[0], CLASS_DIR) end end
# File rdoc/generators/xml_generator.rb, line 113 def gen_an_index(collection, title) res = [] collection.sort.each do |f| if f.document_self res << { "href" => f.path, "name" => f.index_name } end end return { "entries" => res, 'list_title' => title, 'index_url' => main_url, } end
# File rdoc/generators/xml_generator.rb, line 104 def gen_class_index gen_an_index(@classes, 'Classes') end
# File rdoc/generators/xml_generator.rb, line 100 def gen_file_index gen_an_index(@files, 'Files') end
# File rdoc/generators/xml_generator.rb, line 92 def gen_into(list) res = [] list.each do |item| res << item.value_hash end res end
# File rdoc/generators/xml_generator.rb, line 108 def gen_method_index gen_an_index(HtmlMethod.all_methods, 'Methods') end
Generate all the HTML. For the one-file case, we generate all the information in to one big hash
# File rdoc/generators/xml_generator.rb, line 72 def generate_xml values = { 'charset' => @options.charset, 'files' => gen_into(@files), 'classes' => gen_into(@classes) } # this method is defined in the template file write_extra_pages if defined? write_extra_pages template = TemplatePage.new(RDoc::Page::ONE_PAGE) if @options.op_name opfile = File.open(@options.op_name, "w") else opfile = $stdout end template.write_html_on(opfile, values) end
ruby-doc.org is hosted and maintained by James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, Arizona. The site was created in 2002 as part of the Ruby Documentation Project to promote the Ruby language and to help other Ruby hackers.
Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.
For more information on the Ruby programming language, visit ruby-lang.org.
Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.