Created
September 30, 2011 17:14
-
-
Save staszek/1254388 to your computer and use it in GitHub Desktop.
Chain map,each, select etc.
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 to_proc | |
| proc do |obj, *args| | |
| self.inject(obj) do |result, element| | |
| result = result.send(element, *args) | |
| end | |
| end | |
| end | |
| end | |
| ree-1.8.7-2010.02 > ["john", "alice", "ben"].map(&[:reverse, :capitalize, :reverse]) | |
| => ["johN", "alicE", "beN"] |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
could be