This method is deprecated or moved on the latest stable version.
The last existing version (v2_2_9) is shown here.
gemdirs(filter = :latest)
public
The latest installed gems’ ri directories. filter can be :all
or :latest.
A filter :all includes all versions of gems and includes gems
without ri documentation.
# File lib/rdoc/ri/paths.rb, line 83
def self.gemdirs filter = :latest
require 'rubygems' unless defined?(Gem)
ri_paths = {}
all = Gem::Specification.map do |spec|
[File.join(spec.doc_dir, 'ri'), spec.name, spec.version]
end
if filter == :all then
gemdirs = []
all.group_by do |_, name, _|
name
end.sort_by do |group, _|
group
end.map do |group, items|
items.sort_by do |_, _, version|
version
end.reverse_each do |dir,|
gemdirs << dir
end
end
return gemdirs
end
all.each do |dir, name, ver|
next unless File.exist? dir
if ri_paths[name].nil? or ver > ri_paths[name].first then
ri_paths[name] = [ver, name, dir]
end
end
ri_paths.sort_by { |_, (_, name, _)| name }.map { |k, v| v.last }
rescue LoadError
[]
end