Created
April 20, 2010 00:11
-
-
Save mlomnicki/371831 to your computer and use it in GitHub Desktop.
String 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 String | |
def to_proc | |
eval "Proc.new { |*args| args.first#{self} }" | |
end | |
end | |
[1,2,3].collect(&'+5') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment