method
include_file
ruby latest stable - Class:
SM ::PreProcess
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v1_8_7_330) is shown here.
include_file(name, indent)private
Include a file, indenting it correctly
# File lib/rdoc/markup/simple_markup/preprocess.rb, line 43
def include_file(name, indent)
if (full_name = find_include_file(name))
content = File.open(full_name) {|f| f.read}
# strip leading '#'s, but only if all lines start with them
if content =~ /^[^#]/
content.gsub(/^/, indent)
else
content.gsub(/^#?/, indent)
end
else
$stderr.puts "Couldn't find file to include: '#{name}'"
''
end
end