parse_files(options)
public
Parse each file on the command line, recursively entering directories.
Show source
def parse_files(options)
@stats = Stats.new options.verbosity
files = options.files
files = ["."] if files.empty?
file_list = normalized_file_list(options, files, true, options.exclude)
return [] if file_list.empty?
file_info = []
file_list.each do |filename|
@stats.add_file filename
content = if RUBY_VERSION >= '1.9' then
File.open(filename, "r:ascii-8bit") { |f| f.read }
else
File.read filename
end
if defined? Encoding then
if /coding:\s*(\S+)/ =~ content[/\A(?:.*\n){0,2}/]
if enc = ::Encoding.find($1)
content.force_encoding(enc)
end
end
end
top_level = ::RDoc::TopLevel.new filename
parser = ::RDoc::Parser.for top_level, filename, content, options,
@stats
file_info << parser.scan
end
file_info
end