Class: Apidocs::ApiDocs
- Inherits:
-
RDoc::RDoc
- Object
- RDoc::RDoc
- Apidocs::ApiDocs
- Defined in:
- lib/apidocs.rb
Overview
This is class comment
Instance Method Summary collapse
-
#generate_html ⇒ Object
generate_html entry point for on fly document generation.
Instance Method Details
#generate_html ⇒ Object
generate_html entry point for on fly document generation
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/apidocs.rb', line 10 def generate_html FileUtils.rm_rf(Rails.root.join('tmp/apidocs')) = ["app/controllers", "--op=#{Rails.root.join('tmp/apidocs')}"] self.store = RDoc::Store.new @options = @options.parse @exclude = @options.exclude @last_modified = setup_output_dir @options.op_dir, @options.force_update @store.encoding = @options.encoding if @options.respond_to? :encoding @store.dry_run = @options.dry_run @store.main = @options.main_page @store.title = @options.title @store.path = @options.op_dir @start_time = Time.now @store.load_cache @options.default_title = "RDoc Documentation" parse_files @options.files @store.complete @options.visibility all_routes = Rails.application.routes.routes inspector = ActionDispatch::Routing::RoutesInspector.new(all_routes) routes = inspector.send(:collect_routes, inspector.send(:filter_routes, nil)).select {|r| r[:reqs] =~ /#/} routes = routes.map do |r| { verb: r[:verb], path: r[:path], class_name: gen_class_name(r), action_name: gen_action_name(r) } end routes.each do |r| r[:doc] = document_route(r) end formatter = RDoc::Markup::ToHtml.new(RDoc::Options.new) routes.each do |r| r[:html_comment] = r[:doc] ? r[:doc].accept(formatter) : "" end routes.select {|r| r[:class_name] != "ApidocsController" } end |