render_template(template_file, out_file)
protected
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 335
def render_template template_file, out_file # :yield: io
template = template_for template_file
unless @options.dry_run 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
]
end
end