The directories where ri data lives.
Iterates over each selected path yielding the directory and type.
Yielded types:
| :system | Where Ruby’s ri data is stored. Yielded when system is true |
| :site | Where ri for installed libraries are stored. Yielded when site is true. Normally no ri data is stored here. |
| :home | ~/.ri. Yielded when home is true. |
| :gem | ri data for an installed gem. Yielded when gems is true. |
| :extra | ri data directory from the command line. Yielded for each entry in extra_dirs |
# File lib/rdoc/ri/paths.rb, line 45
45: def self.each system, site, home, gems, *extra_dirs # :yields: directory, type
46: extra_dirs.each do |dir|
47: yield dir, :extra
48: end
49:
50: yield SYSDIR, :system if system
51: yield SITEDIR, :site if site
52: yield HOMEDIR, :home if home
53:
54: gemdirs.each do |dir|
55: yield dir, :gem
56: end if gems
57:
58: nil
59: end
The latest installed gems’ ri directories
# File lib/rdoc/ri/paths.rb, line 64
64: def self.gemdirs
65: return @gemdirs if @gemdirs
66:
67: require 'rubygems' unless defined?(Gem)
68:
69: # HACK dup'd from Gem.latest_partials and friends
70: all_paths = []
71:
72: all_paths = Gem.path.map do |dir|
73: Dir[File.join(dir, 'doc', '*', 'ri')]
74: end.flatten
75:
76: ri_paths = {}
77:
78: all_paths.each do |dir|
79: base = File.basename File.dirname(dir)
80: if base =~ /(.*)-((\d+\.)*\d+)/ then
81: name, version = $1, $2
82: ver = Gem::Version.new version
83: if ri_paths[name].nil? or ver > ri_paths[name][0] then
84: ri_paths[name] = [ver, dir]
85: end
86: end
87: end
88:
89: @gemdirs = ri_paths.map { |k,v| v.last }.sort
90: rescue LoadError
91: @gemdirs = []
92: end
Returns existing directories from the selected documentation directories as an Array.
See also ::each
# File lib/rdoc/ri/paths.rb, line 100
100: def self.path(system, site, home, gems, *extra_dirs)
101: path = raw_path system, site, home, gems, *extra_dirs
102:
103: path.select { |directory| File.directory? directory }
104: end
Returns selected documentation directories including nonexistent directories.
See also ::each
# File lib/rdoc/ri/paths.rb, line 112
112: def self.raw_path(system, site, home, gems, *extra_dirs)
113: path = []
114:
115: each(system, site, home, gems, *extra_dirs) do |dir, type|
116: path << dir
117: end
118:
119: path.compact
120: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.