Skip to content

Instantly share code, notes, and snippets.

@vangberg
Created August 6, 2009 11:41
Show Gist options
  • Save vangberg/163268 to your computer and use it in GitHub Desktop.
Save vangberg/163268 to your computer and use it in GitHub Desktop.
class Array
def >> obj
ArrayMover.new delete(obj)
end
end
class ArrayMover
def initialize(obj)
@obj = obj
end
def >> array
array << @obj
end
end
arr1 = [1,2,3]
arr2 = []
arr1 >> 2 >> arr2
arr1 #=> [1,3]
arr2 #=> [2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment