method
store_for
v2_1_10 -
Show latest stable
- Class:
RDoc::Servlet
store_for(source_name)public
Returns an RDoc::Store for the given source_name (‘ruby’ or a gem name).
# File lib/rdoc/servlet.rb, line 408
def store_for source_name
case source_name
when 'home' then
RDoc::Store.new RDoc::RI::Paths.home_dir, :home
when 'ruby' then
RDoc::Store.new RDoc::RI::Paths.system_dir, :system
when 'site' then
RDoc::Store.new RDoc::RI::Paths.site_dir, :site
when /^extra-(\d+)$/ then
index = $1.to_i - 1
ri_dir = installed_docs[index][4]
RDoc::Store.new ri_dir, :extra
else
ri_dir, type = ri_paths.find do |dir, dir_type|
next unless dir_type == :gem
source_name == dir[%/([^/]*)/ri$%, 1]
end
raise WEBrick::HTTPStatus::NotFound,
"Could not find gem \"#{source_name}\". Are you sure you installed it?" unless ri_dir
store = RDoc::Store.new ri_dir, type
return store if File.exist? store.cache_path
raise WEBrick::HTTPStatus::NotFound,
"Could not find documentation for \"#{source_name}\". Please run `gem rdoc --ri gem_name`"
end
end