Possible Duplicate:
Array#rotate equivalent in ruby 1.8.7
According to ruby-doc.org the syntax I’m entering should be working, but it produces a NoMethod error when run in IRB.
>> a = ["1", "2", "3", "4", "5"]
=> ["1", "2", "3", "4", "5"]
>> a.rotate
NoMethodError: undefined method `rotate' for ["1", "2", "3", "4", "5"]:Array
from (irb):14
What is the reason for the occurrence of this error?
It’s new to Ruby 1.9. You must be using Ruby 1.8.6 or 1.8.7.
Here is what you can do.