Ruby 1.9.2 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > Arrayクラス > rotate!
rotate!(cnt=1) -> self
Rotates _self_ in place so that the element at +cnt+ comes first, and returns _self_. If +cnt+ is negative then it rotates in counter direction.
a = [ "a", "b", "c", "d" ] a.rotate! #=> ["b", "c", "d", "a"] a #=> ["b", "c", "d", "a"] a.rotate!(2) #=> ["d", "a", "b", "c"] a.rotate!(-3) #=> ["a", "b", "c", "d"]
[SEE_ALSO] Array#rotate