[patch] for ri case sensitivity (was - RE: disable ri case se nsit ive)

#|ok, i got a hack.

···

Yukihiro Matsumoto [mailto:matz@ruby-lang.org] aka matz wrote:

#
#|patch follows
#
#Use unified diff (diff -u), or at least context diff (diff -c).

as requested, sir Matz,
----------------------

C:\ruby\lib\ruby\1.8\rdoc\ri>diff -u ri_util.rb.orig ri_util.rb
--- ri_util.rb.orig Thu Mar 25 03:59:27 2004
+++ ri_util.rb Sat Jul 09 10:03:10 2005
@@ -30,15 +30,40 @@
     separator = nil

     tokens = arg.split(/(\.|::|#)/)
-
+
+ #========================================
+ # start of immunization if casing problem
+ # all programmers are lazy
+ # so, let us take care of the casing thing
+
+ if tokens.size < 2
+ # it's a single word; check if the casing is garbled
+ t = tokens[0]
+ if (t != t.downcase) and
+ (t != t.capitalize)
+ t.downcase! # it's garbled and we're defaulting to downcase (as
method)
+ end
+ else
+ # multiple words
+ # capitalize them all
+ tokens.map!{ |x| x.capitalize }
+ # but methods should be downcased however if present
+ if tokens[-2] =~ /\.|#|/
+ tokens[-1] = tokens[-1].downcase
+ end
+ end
+
+ # end of immunization of casing problem
+ #========================================
+
     # Skip leading '::', '#' or '.', but remember it might
     # be a method name qualifier
     separator = tokens.shift if tokens[0] =~ /^(\.|::|#)/

     # Skip leading '::', but remember we potentially have an inst
-
     # leading stuff must be class names

+
     while tokens[0] =~ /^[A-Z]/
       @class_names << tokens.shift
       unless tokens.empty?
@@ -72,4 +97,7 @@
   def full_class_name
     @class_names.join("::")
   end
+
+
end
+
---------------------------

Thanks and kind regards -botp
Thanks also to gavin_k for the capitalize tip.

#
# matz.
#