Created
March 14, 2012 02:31
-
-
Save Asher-/2033555 to your computer and use it in GitHub Desktop.
to_lambda
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 Proc | |
def to_lambda | |
# this is a bullshit solution to a simple problem of converting proc to lambda | |
# this is a stupid hack, so anyone with a better way please let me know | |
# this enables return to be used in block context | |
return define_singleton_method( :proc_to_lambda_junk_method, & self ).to_proc | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment