Created
November 10, 2012 05:11
-
-
Save srabuini/4050005 to your computer and use it in GitHub Desktop.
Move elements a number (positive or negative) of steps and return it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array | |
def move(steps) | |
(steps % size).times { self << shift }; return self | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment