Re: Possible Regexp documentation bug

"Konrad Meyer" <[email protected]> Sun, 15 Jul 2007 11:37:00 -0700
Newsgroups gmane.comp.lang.ruby.documentation
Message-ID <[email protected]>
On 15/07/07, Chris Wilson <[email protected]> wrote:
> On Sun, 15 Jul 2007, Konrad Meyer wrote:
>
> >>  "(Regexp.escape) Escapes any characters that would have special meaning in
> >>  a regular expression. Returns a new escaped string, or self if no
> >>  characters are escaped. For any string, Regexp.escape(str)=~str will be
> >>  true."
> ...
> >>  I think it would be more accurate to say:
> >>
> >>     "str =~ Regexp.escape(str) will be true."
> ...
> > While =~ is not an operator, it is a method of String and Regexp
> > instances, Regexp.escape (from quick irb testing) returns a string.
> > And String#=~ expects a Regexp instance, not a string. So I think it
> > would be correct to change that to something like `Regexp.escape(str)
> > =~ Regexp.new(str) will be true'.
>
> Thanks Konrad and Ryan. Is the attached patch acceptable, documenting both
> forms in what I believe is the correct way?

Er, and also the changelog entry for documentation is probably a
little excessive.