summaryrefslogtreecommitdiff
path: root/lib/rdoc
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-12 18:13:48 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-12 18:13:48 +0000
commit4514a6bee646262b62db7438cc149a7ff651adb4 (patch)
tree2702668b00b125305d1c0fc8094b6978e501a5fc /lib/rdoc
parentdb49143cdaa0ff3504531bd32297be9ecb9a2bc3 (diff)
* 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
Diffstat (limited to 'lib/rdoc')
-rw-r--r--lib/rdoc/ri/driver.rb12
-rw-r--r--lib/rdoc/ri/util.rb2
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb
index 02271de3dd..b254d3574f 100644
--- a/lib/rdoc/ri/driver.rb
+++ b/lib/rdoc/ri/driver.rb
@@ -200,7 +200,10 @@ Options may also be set in the 'RI' environment variable.
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 @@ Options may also be set in the 'RI' environment variable.
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 @@ Options may also be set in the 'RI' environment variable.
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
diff --git a/lib/rdoc/ri/util.rb b/lib/rdoc/ri/util.rb
index c4e6af47f0..34277f2594 100644
--- a/lib/rdoc/ri/util.rb
+++ b/lib/rdoc/ri/util.rb
@@ -62,7 +62,7 @@ class RDoc::RI::NameDescriptor
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 == "::"