Bugs item #6034, was opened at 2006-10-05 18:56
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=6034&group_id=426

Category: Documentation
Group: 1.8.x
Status: Open
Resolution: None
Priority: 3
Submitted By: Kulpreet Singh (jungly)
Assigned to: Eric Hodel (drbrain)
Summary: Documentation for String.scan has a bad example.

Initial Comment:
The documentation for String.scan says -

And the block form:

        a.scan(/\w+/) {|w| print "<<#{w}>> " }
        print "\n"
        a.scan(/(.)(.)/) {|a,b| print b, a }
        print "\n"

     _produces:_

        <<cruel>> <<world>>
        rceu lowlr

In the statement 
a.scan(/(.)(.)/) {|a,b| print b, a }

the use of variable "a" inside the block confuses the novice.

Its a simple variable fix.

Thanks



----------------------------------------------------------------------

Comment By: Nobuyoshi Nakada  (nobu)
Date: 2007-05-10 09:47

Message:
This bug is fixed in the repository.

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=6034&group_id=426