diff options
author | dave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-01-07 04:05:25 +0000 |
---|---|---|
committer | dave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-01-07 04:05:25 +0000 |
commit | 305cc5d2d9dabbc61a03f65d22d94f9161ecd8a4 (patch) | |
tree | 9e32c5d7f388aef5e703cc49285c352988206f3f | |
parent | cc2fdd8213042eb81801deaaeacfb0cd2cb9dbf5 (diff) | |
download | ruby-305cc5d2d9dabbc61a03f65d22d94f9161ecd8a4.tar.gz |
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
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | lib/rdoc/ri/ri_driver.rb | 25 | ||||
-rw-r--r-- | lib/rdoc/ri/ri_util.rb | 7 |
3 files changed, 30 insertions, 9 deletions
@@ -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 diff --git a/lib/rdoc/ri/ri_driver.rb b/lib/rdoc/ri/ri_driver.rb index 0ca3b4c224..039a152c84 100644 --- a/lib/rdoc/ri/ri_driver.rb +++ b/lib/rdoc/ri/ri_driver.rb @@ -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, diff --git a/lib/rdoc/ri/ri_util.rb b/lib/rdoc/ri/ri_util.rb index 6e52cd069f..d8678c49d7 100644 --- a/lib/rdoc/ri/ri_util.rb +++ b/lib/rdoc/ri/ri_util.rb @@ -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 |