Version 2.0.0, what has replaced scan?

A friend wrote a brief Ruby script (attached) which downloads game files
from a website. It worked for 1.7, but not for 2.0. Here is the error I
get:

[email protected]:~/games/Twixt/sw$ ruby ./getgame.rb 1522422 1522423
1522424 1522431
./getgame.rb:91:in getPlayer1': undefined methodscan’ for
nil:NilClass (NoMethodError)
from ./getgame.rb:143:in getJtwixtFileData' from ./getgame.rb:164:ingetGame’
from ./getgame.rb:179:in block in <main>' from ./getgame.rb:178:ineach’
from ./getgame.rb:178:in `’
[email protected]:~/games/Twixt/sw$

Is there a list of changes to Ruby since 1.7? Any clue would be
appreciated. Thanks for your time.

David

On 7/03/2013, at 1:08 PM, David B. [email protected] wrote:

A friend wrote a brief Ruby script (attached) which downloads game files
from a website. It worked for 1.7, but not for 2.0. Here is the error I
get:

[email protected]:~/games/Twixt/sw$ ruby ./getgame.rb 1522422 1522423
1522424 1522431
./getgame.rb:91:in getPlayer1': undefined methodscan’ for
nil:NilClass (NoMethodError)

It isn’t a difference between Ruby versions. You are trying to call scan
on nil, this has never worked.

Show us the code and we might have a better idea of your problem.

Henry

On 7/03/2013, at 1:17 PM, Henry M. [email protected] wrote:

Show us the code and we might have a better idea of your problem.

Sorry I missed the attachment

It looks to me that you aren’t being careful enough in checking the
server responses in getGame. lgData on line 155 is nil.

Incidentally, I ran your script and it worked so maybe there was a
transient server error.

Henry

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs