Method deprecated or moved
This method is deprecated or moved on the latest stable version.
The last existing version (v2_2_9) is shown here.
render_template(template_file, out_file = nil)
public
Load and render the erb
template in the given template_file and write it out to
out_file.
Both template_file and out_file should be Pathname-like objects.
An io will be yielded which must be captured by binding in the caller.
# File lib/rdoc/generator/darkfish.rb, line 689
def render_template template_file, out_file = nil # :yield: io
io_output = out_file && !@dry_run && @file_output
erb_klass = io_output ? RDoc::ERBIO : ERB
template = template_for template_file, true, erb_klass
if io_output then
debug_msg "Outputting to %s" % [out_file.expand_path]
out_file.dirname.mkpath
out_file.open 'w', 0644 do |io|
io.set_encoding @options.encoding if Object.const_defined? :Encoding
@context = yield io
template_result template, @context, template_file
end
else
@context = yield nil
output = template_result template, @context, template_file
debug_msg " would have written %d characters to %s" % [
output.length, out_file.expand_path
] if @dry_run
output
end
end