On Jun 27, 2006, at 7:00 AM, Alex Young wrote: > Yukihiro Matsumoto wrote: >> Hi, >> In message "Re: Core documentation patches" >> on Tue, 27 Jun 2006 18:46:40 +0900, Alex Young >> <alex / blackkettle.org> writes: >> |I've got a little documentation patch for 1.8.5... Should it go >> here? >> Yes, drbrain or myself would commit the patch. >> matz. > Excellent. A minor correction to the String#=~ documentation is > attached. It had me running round in circles for a bit. > > -- > Alex > Index: string.c > =================================================================== > --- string.c (revision 1) > +++ string.c (working copy) > @@ -1278,13 +1278,11 @@ > * str =~ obj => fixnum or nil > * > * Match---If <i>obj</i> is a <code>Regexp</code>, use it as a > pattern to match > - * against <i>str</i>. If <i>obj</i> is a <code>String</code>, > look for it in > - * <i>str</i> (similar to <code>String#index</code>). Returns the > position the > - * match starts, or <code>nil</code> if there is no match. > Otherwise, invokes > + * against <i>str</i>,and returns the position the match starts, or > + * <code>nil</code> if there is no match. Otherwise, invokes > * <i>obj.=~</i>, passing <i>str</i> as an argument. The default > * <code>=~</code> in <code>Object</code> returns <code>false</ > code>. > * > - * "cat o' 9 tails" =~ '\d' #=> nil > * "cat o' 9 tails" =~ /\d/ #=> 7 > * "cat o' 9 tails" =~ 9 #=> false > */ Should this me mentioned? $ ruby -ve "'cat \'o 9 tails' =~ '\d'" ruby 1.8.5 (2006-06-27) [powerpc-darwin8.6.0] -e:1:in `=~': type mismatch: String given (TypeError) from -e:1 -- Eric Hodel - drbrain / segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com