1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix problem with agreesive name matching (see ChangeLog)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
dave 2004-01-07 04:05:25 +00:00
parent cc2fdd8213
commit 305cc5d2d9
3 changed files with 30 additions and 9 deletions

View file

@ -1,3 +1,10 @@
Wed Jan 7 13:00:18 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/ri/ri_driver.rb: Fix problem where ri was
being too eager to find matches of ambiguous method
names (such as "ri Thread.join" would return both
Thread.join and ThreadsWait.join)
Wed Jan 7 12:35:41 2004 NAKAMURA, Hiroshi <nakahiro@sarion.co.jp>
* lib/debug.rb: revert command parse regexps. [ruby-list:39014] by

View file

@ -52,18 +52,18 @@ class RiDriver
######################################################################
def report_class_stuff(requested_class_name, namespaces)
def report_class_stuff(namespaces)
if namespaces.size == 1
klass = @ri_reader.get_class(namespaces[0])
@display.display_class_info(klass, @ri_reader)
else
entries = namespaces.find_all {|m| m.full_name == requested_class_name}
if entries.size == 1
klass = @ri_reader.get_class(entries[0])
@display.display_class_info(klass, @ri_reader)
else
# entries = namespaces.find_all {|m| m.full_name == requested_class_name}
# if entries.size == 1
# klass = @ri_reader.get_class(entries[0])
# @display.display_class_info(klass, @ri_reader)
# else
@display.display_class_list(namespaces)
end
# end
end
end
@ -81,9 +81,16 @@ class RiDriver
raise RiError.new("Nothing known about #{arg}")
end
end
# at this point, if we have multiple possible namespaces, but one
# is an exact match for our requested class, prune down to just it
full_class_name = desc.full_class_name
entries = namespaces.find_all {|m| m.full_name == full_class_name}
namespaces = entries if entries.size == 1
if desc.method_name.nil?
report_class_stuff(desc.class_names.join('::'), namespaces)
report_class_stuff(namespaces)
else
methods = @ri_reader.find_methods(desc.method_name,
desc.is_class_method,

View file

@ -64,4 +64,11 @@ class NameDescriptor
end
end
end
# Return the full class name (with '::' between the components)
# or "" if there's no class name
def full_class_name
@class_names.join("::")
end
end