From da99e407fbf36051bf9ebce01418589bff557298 Mon Sep 17 00:00:00 2001 From: dave Date: Sun, 21 Dec 2003 07:28:54 +0000 Subject: Add file.c comments (and necessary support in parse_c.rb) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- bin/ri | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'bin') diff --git a/bin/ri b/bin/ri index c57d2c1f0b..07f7bc33da 100755 --- a/bin/ri +++ b/bin/ri @@ -48,7 +48,7 @@ class RiDisplay exit 1 end @ri_reader = RI::RiReader.new(RI::RiCache.new(paths)) - @formatter = RI::RiFormatter.new(@options.width, " ") + @formatter = RI::TextFormatter.create(@options, " ") end @@ -127,7 +127,7 @@ end def display_class_info(class_entry) klass = @ri_reader.get_class(class_entry) - @formatter.draw_line("Class: " + klass.full_name) + @formatter.draw_line(klass.display_name + ": " + klass.full_name) display_flow(klass.comment) @formatter.draw_line @@ -190,12 +190,15 @@ end def report_method_stuff(requested_method_name, methods) if methods.size == 1 display_method_info(methods[0]) - elsif (entry = methods.find {|m| m.name == requested_method_name}) - display_method_info(entry) else - puts "More than one method matched your request. You can refine" - puts "your search by asking for information on one of:\n\n" - @formatter.wrap(methods.map {|m| m.full_name} .join(", ")) + entries = methods.find_all {|m| m.name == requested_method_name} + if entries.size == 1 + display_method_info(entries[0]) + else + puts "More than one method matched your request. You can refine" + puts "your search by asking for information on one of:\n\n" + @formatter.wrap(methods.map {|m| m.full_name} .join(", ")) + end end end @@ -204,12 +207,15 @@ end 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" - @formatter.wrap(namespaces.map {|m| m.full_name}.join(", ")) + else + entries = namespaces.find_all {|m| m.name == requested_class_name} + if entries.size == 1 + display_class_info(entries[0]) + 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" + @formatter.wrap(namespaces.map {|m| m.full_name}.join(", ")) + end end end -- cgit v1.2.3