class RDoc::Parser

def self.can_parse_by_name file_name

def self.can_parse_by_name file_name
  _, parser = RDoc::Parser.parsers.find { |regexp,| regexp =~ file_name }
  # The default parser must not parse binary files
  ext_name = File.extname file_name
  return parser if ext_name.empty?
  if parser == RDoc::Parser::Simple and ext_name !~ /txt|rdoc/ then
    case check_modeline file_name
    when nil, 'rdoc' then # continue
    else return nil
    end
  end
  parser
rescue Errno::EACCES
end