nobu.nokada
7/9/2005 3:11:00 AM
Hi,
At Fri, 8 Jul 2005 18:20:26 +0900,
Peña, Botp wrote in [ruby-talk:147544]:
> pardon me if it's too elementary or buggy or what, but hey, it works great
> for me and i have lesser worry on my casing/typing :-)
It seems not to work with a multi-worded class name, e.g.,
SystemCallError#errno.
$ ./ruby bin/ri -T systemcall#errno
Nothing known about systemcall#errno
Another patch.
Index: lib/rdoc/ri/ri_cache.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/lib/rdoc/ri/ri_cache.rb,v
retrieving revision 1.8
diff -U2 -p -w -r1.8 ri_cache.rb
--- lib/rdoc/ri/ri_cache.rb 30 Aug 2004 14:20:57 -0000 1.8
+++ lib/rdoc/ri/ri_cache.rb 9 Jul 2005 02:55:05 -0000
@@ -33,5 +33,5 @@ module RI
# convert from external to internal form, and
- # extract the instance/class flag
+ # extract the "instance/class" flag
if name =~ /^(.*?)-(c|i).yaml$/
@@ -62,5 +62,10 @@ module RI
def contained_modules_matching(name)
- @inferior_classes.find_all {|c| c.name[name]}
+ mods = @inferior_classes.find_all {|c| c.name[name]}
+ if mods.empty?
+ name = name.downcase
+ mods = @inferior_classes.find_all {|c| c.name.downcase[name]}
+ end
+ mods
end
@@ -71,5 +76,6 @@ module RI
# Return an exact match to a particular name
def contained_class_named(name)
- @inferior_classes.find {|c| c.name == name}
+ @inferior_classes.find {|c| c.name == name} or
+ @inferior_classes.find {|c| c.name.casecmp(name).zero?}
end
Index: lib/rdoc/ri/ri_util.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/lib/rdoc/ri/ri_util.rb,v
retrieving revision 1.5
diff -U2 -p -w -r1.5 ri_util.rb
--- lib/rdoc/ri/ri_util.rb 24 Mar 2004 18:59:10 -0000 1.5
+++ lib/rdoc/ri/ri_util.rb 9 Jul 2005 02:55:50 -0000
@@ -30,9 +30,9 @@ class NameDescriptor
separator = nil
- tokens = arg.split(/(\.|::|#)/)
+ tokens = arg.split(/(\.|::|\#)/)
# Skip leading '::', '#' or '.', but remember it might
# be a method name qualifier
- separator = tokens.shift if tokens[0] =~ /^(\.|::|#)/
+ separator = tokens.shift if /^(\.|::|\#)/ =~ tokens[0]
# Skip leading '::', but remember we potentially have an inst
@@ -40,5 +40,5 @@ class NameDescriptor
# leading stuff must be class names
- while tokens[0] =~ /^[A-Z]/
+ while /^[A-Z]/ =~ tokens[0] or /::|\#/ =~ tokens[1]
@class_names << tokens.shift
unless tokens.empty?
--
Nobu Nakada