R
RichardOnRails
I'm runing Ruby 1.8.6 over WinXP-Pro/SP3
I'm writing a program to illustrate prime numbers and Ruby programming
for my teenage granddaughter. Unfortunately, I've got a problem:
On line 54, I've got the statement:
$primes.rotate!(group_size)
That results in the error:
Adrienne01.rb:54: undefined method `rotate!' for [2, 3, 5, 7]:Array
(NoMethodError)
However, http://www.ruby-doc.org/core/ defines "ary.rotate!(cnt=1) -->
ary"
Also, "rotate" (without the bang) is defined in Ruby/core and fails in
the same manner.
I've posted the program and its output in http://www.pastie.org/1674687
Is Array#rotate! only defined in a Ruby version later than mine? Or
is there something I'm missing here?
Any guidance offered will be gratefully received.
Best wishes,
Richard
I'm writing a program to illustrate prime numbers and Ruby programming
for my teenage granddaughter. Unfortunately, I've got a problem:
On line 54, I've got the statement:
$primes.rotate!(group_size)
That results in the error:
Adrienne01.rb:54: undefined method `rotate!' for [2, 3, 5, 7]:Array
(NoMethodError)
However, http://www.ruby-doc.org/core/ defines "ary.rotate!(cnt=1) -->
ary"
Also, "rotate" (without the bang) is defined in Ruby/core and fails in
the same manner.
I've posted the program and its output in http://www.pastie.org/1674687
Is Array#rotate! only defined in a Ruby version later than mine? Or
is there something I'm missing here?
Any guidance offered will be gratefully received.
Best wishes,
Richard