Skip to content

Instantly share code, notes, and snippets.

@srabuini
Created November 10, 2012 05:11
Show Gist options
  • Save srabuini/4050005 to your computer and use it in GitHub Desktop.
Save srabuini/4050005 to your computer and use it in GitHub Desktop.
Move elements a number (positive or negative) of steps and return it
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