Created
          August 6, 2009 11:41 
        
      - 
      
- 
        Save vangberg/163268 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or 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 >> 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