ruby-changes:4271
From: ko1@a...
Date: Thu, 13 Mar 2008 03:14:08 +0900 (JST)
Subject: [ruby-changes:4271] matz - Ruby:r15761 (trunk): * lib/irb/cmd/help.rb: should be updated for new ri structure.
matz 2008-03-13 03:13:48 +0900 (Thu, 13 Mar 2008) New Revision: 15761 Modified files: trunk/ChangeLog trunk/lib/irb/cmd/help.rb trunk/lib/rdoc/ri/driver.rb trunk/lib/rdoc/ri/util.rb Log: * 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. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rdoc/ri/driver.rb?r1=15761&r2=15760&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/irb/cmd/help.rb?r1=15761&r2=15760&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15761&r2=15760&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/rdoc/ri/util.rb?r1=15761&r2=15760&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 15760) +++ ChangeLog (revision 15761) @@ -1,3 +1,19 @@ +Thu Mar 13 03:12:48 2008 Yukihiro Matsumoto <matz@r...> + + * 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@r...> * configure.in (stdint.h): check if presence. Index: lib/irb/cmd/help.rb =================================================================== --- lib/irb/cmd/help.rb (revision 15760) +++ lib/irb/cmd/help.rb (revision 15761) @@ -8,20 +8,21 @@ # # -require 'rdoc/ri/ri_driver' +require 'rdoc/ri/driver' +require 'rdoc/ri/util' module IRB module ExtendCommand module Help begin - @ri = RiDriver.new + @ri = RDoc::RI::Driver.new rescue SystemExit else def self.execute(context, *names) names.each do |name| begin @ri.get_info_for(name.to_s) - rescue RiError + rescue RDoc::RI::Error puts $!.message end end Index: lib/rdoc/ri/util.rb =================================================================== --- lib/rdoc/ri/util.rb (revision 15760) +++ lib/rdoc/ri/util.rb (revision 15761) @@ -62,7 +62,7 @@ end if @method_name =~ /::|\.|#/ or !tokens.empty? - raise RiError.new("Bad argument: #{arg}") + raise RDoc::RI::Error.new("Bad argument: #{arg}") end if separator && separator != '.' @is_class_method = separator == "::" Index: lib/rdoc/ri/driver.rb =================================================================== --- lib/rdoc/ri/driver.rb (revision 15760) +++ lib/rdoc/ri/driver.rb (revision 15761) @@ -200,7 +200,10 @@ ri.run 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] @class_cache_name = 'classes' @@ -226,7 +229,7 @@ end.max 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 load_cache_for @class_cache_name @@ -344,6 +347,11 @@ YAML.load File.read(path).gsub(/ \!ruby\/(object|struct):(RDoc::RI|RI|SM).*/, '') end + def get_info_for(arg) + @names = [arg] + run + end + def run if @names.empty? then @display.list_known_classes class_cache.keys.sort -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/