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 | cf9d6df82291191e6d143c4539a27e05a8152a73 (patch) | |
tree | 9e32c5d7f388aef5e703cc49285c352988206f3f | |
parent | 28b46cad7d45168de283b5901384ce3d823abfec (diff) | |
download | ruby-cf9d6df82291191e6d143c4539a27e05a8152a73.tar.gz ruby-cf9d6df82291191e6d143c4539a27e05a8152a73.tar.xz ruby-cf9d6df82291191e6d143c4539a27e05a8152a73.zip |
Fix problem with agreesive name matching (see ChangeLog)
git-svn-id: http://svn.ruby-lang.org/repos/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 0ca3b4c22..039a152c8 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 6e52cd069..d8678c49d 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 |