aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rdoc/ri/driver.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/ri/driver.rb')
-rw-r--r--lib/rdoc/ri/driver.rb12
1 files changed, 10 insertions, 2 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