def rebuild_index(paths = nil)
@paths = paths || RI::Paths::PATH
@gem_names = paths.map do |p|
fullp = File.expand_path(p)
gemname = nil
begin
require 'rubygems'
Gem.path.each do |gempath|
re = %r!^#{Regexp.escape(File.expand_path(gempath))}/doc/!
if re =~ fullp
gemname = fullp.gsub(re,"")[%r{^[^/]+}]
break
end
end
rescue LoadError
end
gemname ? gemname : "system"
end
methods = Hash.new{|h,k| h[k] = []}
namespaces = methods.clone
@paths.each_with_index do |path, source_index|
ri_reader = RI::RiReader.new(RI::RiCache.new(path))
obtain_classes(ri_reader.top_level_namespace.first).each{|name| namespaces[name] << source_index }
obtain_methods(ri_reader.top_level_namespace.first).each{|name| methods[name] << source_index }
end
@method_array = methods.sort_by{|h,k| h}.map do |name, sources|
"#{name} #{sources.map{|x| x.to_s}.join(' ')}"
end
@namespace_array = namespaces.sort_by{|h,k| h}.map do |name, sources|
"#{name} #{sources.map{|x| x.to_s}.join(' ')}"
end
??
end