* lib/irb/cmd/help.rb: should be updated for new ri structure.

[ruby-core:15825]

* lib/rdoc/ri/driver.rb (RDoc::initialize): allow options to be optional.

* lib/rdoc/ri/driver.rb (RDoc::class_cache): map_dirs may be
  empty.

* lib/rdoc/ri/driver.rb (RDoc::get_info_for): revive get_info_for
  method.  maybe broken.

* lib/rdoc/ri/util.rb (RDoc::initialize): should not use RiError
  no more.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-03-12 18:13:48 +00:00
parent db49143cda
commit 4514a6bee6
4 changed files with 31 additions and 6 deletions

View File

@ -1,3 +1,19 @@
Thu Mar 13 03:12:48 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* lib/irb/cmd/help.rb: should be updated for new ri structure.
[ruby-core:15825]
* lib/rdoc/ri/driver.rb (RDoc::initialize): allow options to be optional.
* lib/rdoc/ri/driver.rb (RDoc::class_cache): map_dirs may be
empty.
* lib/rdoc/ri/driver.rb (RDoc::get_info_for): revive get_info_for
method. maybe broken.
* lib/rdoc/ri/util.rb (RDoc::initialize): should not use RiError
no more.
Thu Mar 13 01:45:25 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> Thu Mar 13 01:45:25 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (stdint.h): check if presence. * configure.in (stdint.h): check if presence.

View File

@ -8,20 +8,21 @@
# #
# #
require 'rdoc/ri/ri_driver' require 'rdoc/ri/driver'
require 'rdoc/ri/util'
module IRB module IRB
module ExtendCommand module ExtendCommand
module Help module Help
begin begin
@ri = RiDriver.new @ri = RDoc::RI::Driver.new
rescue SystemExit rescue SystemExit
else else
def self.execute(context, *names) def self.execute(context, *names)
names.each do |name| names.each do |name|
begin begin
@ri.get_info_for(name.to_s) @ri.get_info_for(name.to_s)
rescue RiError rescue RDoc::RI::Error
puts $!.message puts $!.message
end end
end end

View File

@ -200,7 +200,10 @@ Options may also be set in the 'RI' environment variable.
ri.run ri.run
end end
def initialize(options) def initialize(options={})
options[:formatter] ||= RDoc::RI::Formatter.for('plain')
options[:use_stdout] ||= !$stdout.tty?
options[:width] ||= 72
@names = options[:names] @names = options[:names]
@class_cache_name = 'classes' @class_cache_name = 'classes'
@ -226,7 +229,7 @@ Options may also be set in the 'RI' environment variable.
end.max end.max
up_to_date = (File.exist?(class_cache_file_path) and up_to_date = (File.exist?(class_cache_file_path) and
newest < File.mtime(class_cache_file_path)) newest and newest < File.mtime(class_cache_file_path))
@class_cache = if up_to_date then @class_cache = if up_to_date then
load_cache_for @class_cache_name load_cache_for @class_cache_name
@ -344,6 +347,11 @@ Options may also be set in the 'RI' environment variable.
YAML.load File.read(path).gsub(/ \!ruby\/(object|struct):(RDoc::RI|RI|SM).*/, '') YAML.load File.read(path).gsub(/ \!ruby\/(object|struct):(RDoc::RI|RI|SM).*/, '')
end end
def get_info_for(arg)
@names = [arg]
run
end
def run def run
if @names.empty? then if @names.empty? then
@display.list_known_classes class_cache.keys.sort @display.list_known_classes class_cache.keys.sort

View File

@ -62,7 +62,7 @@ class RDoc::RI::NameDescriptor
end end
if @method_name =~ /::|\.|#/ or !tokens.empty? if @method_name =~ /::|\.|#/ or !tokens.empty?
raise RiError.new("Bad argument: #{arg}") raise RDoc::RI::Error.new("Bad argument: #{arg}")
end end
if separator && separator != '.' if separator && separator != '.'
@is_class_method = separator == "::" @is_class_method = separator == "::"