Class: Generators::HtmlMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/rdoc/generators/template/html/resh/resh.rb

Instance Method Summary collapse

Instance Method Details

#create_source_code_file(code_body) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/rdoc/generators/template/html/resh/resh.rb', line 56

def create_source_code_file(code_body)
  return unless defined? RDoc::Page::SRC_PAGE
  meth_path = @html_class.path.sub(/\.html$/, '.src')
  File.makedirs(meth_path)
  file_path = File.join(meth_path, @seq) + ".html"

  File.open(file_path, "w") do |f|
    values = {
      'title'     => CGI.escapeHTML(index_name),
      'code'      => code_body,
      'style_url' => style_url(file_path, @options.css),
      'charset'   => @options.charset
    }
    f << ERB.new(File.read($tmpl+RDoc::Page::SRC_PAGE)).result(binding)
  end
  HTMLGenerator.gen_url(path, file_path)
end