summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authordave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-19 03:58:57 +0000
committerdave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-19 03:58:57 +0000
commit8ed8664aa7ca657f536d507ac6de84d71e02e31b (patch)
treec38efde703164c6ecbbade0b477a7b1318c18086 /bin
parentd3b74e1806e572592b4242bee140813ffeefdaf1 (diff)
downloadruby-8ed8664aa7ca657f536d507ac6de84d71e02e31b.tar.gz
Add boot_classes to rdoc parsing, fix a couple of bugs
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ri17
1 files changed, 10 insertions, 7 deletions
diff --git a/bin/ri b/bin/ri
index d5277e1a7a..c57d2c1f0b 100755
--- a/bin/ri
+++ b/bin/ri
@@ -10,6 +10,8 @@
# All names may be abbreviated to their minimum unbiguous form. If a name
# _is_ ambiguous, all valid options will be listed.
#
+# The form '.' method matches either class or instance methods, while
+# #method matches only instance and ::method matches only class methods.
require 'rdoc/ri/ri_paths'
require 'rdoc/ri/ri_cache'
@@ -199,14 +201,15 @@ end
######################################################################
-def report_class_stuff(namespaces)
- if namespaces.size > 1
+def report_class_stuff(requested_class_name, namespaces)
+ if namespaces.size == 1
+ display_class_info(namespaces[0])
+ elsif (entry = namespaces.find {|m| m.name == requested_class_name})
+ display_class_info(entry)
+ else
puts "More than one class or module matched your request. You can refine"
puts "your search by asking for information on one of:\n\n"
- puts @formatter.wrap("", namespaces.map {|m| m.full_name} .join(", "))
- else
- class_desc = @ri_reader.get_class(namespaces[0])
- display_class_info(namespaces[0])
+ @formatter.wrap(namespaces.map {|m| m.full_name}.join(", "))
end
end
@@ -229,7 +232,7 @@ def display_info_for(arg)
begin
if desc.method_name.nil?
- report_class_stuff(namespaces)
+ report_class_stuff(desc.class_names.join('::'), namespaces)
else
methods = @ri_reader.find_methods(desc.method_name,
desc.is_class_method,