method
parse_files
v1_9_1_378 -
Show latest stable
- Class:
RDoc::RDoc
parse_files(options)public
Parse each file on the command line, recursively entering directories.
# File lib/rdoc/rdoc.rb, line 191
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 Related methods
- Instance methods
- document
- error
- list_files_in_directory
- normalized_file_list
- output_flag_file
- parse_dot_doc_file
- parse_files
- setup_output_dir
- update_output_dir
- Class methods
- new