Method: RDoc::Servlet#documentation_page

Defined in:
lib/rdoc/servlet.rb

#documentation_page(store, generator, path, req, res) ⇒ Object

Fills in res with the class, module or page for req from store.

path is relative to the mount_path and is used to determine the class, module or page name (/RDoc/Servlet.html becomes RDoc::Servlet). generator is used to create the page.



152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/rdoc/servlet.rb', line 152

def documentation_page store, generator, path, req, res
  text_name = path.chomp '.html'
  name = text_name.gsub '/', '::'

  if klass = store.find_class_or_module(name) then
    res.body = generator.generate_class klass
  elsif page = store.find_text_page(name.sub(/_([^_]*)\z/, '.\1')) then
    res.body = generator.generate_page page
  elsif page = store.find_text_page(text_name.sub(/_([^_]*)\z/, '.\1')) then
    res.body = generator.generate_page page
  else
    not_found generator, req, res
  end
end