Created
August 9, 2011 11:31
-
-
Save JamesKyburz/1133809 to your computer and use it in GitHub Desktop.
Allow sending extra parameters when using #symbol.to_proc
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 Symbol | |
def [](*args) | |
proc {|obj| | |
obj.send(self,*args) | |
} | |
end | |
end | |
__END__ | |
use case | |
[1,2,3,4].map(&:+[2]) # => [3, 4, 5, 6] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment