Skip to content

Instantly share code, notes, and snippets.

@Asher-
Created March 14, 2012 02:31
Show Gist options
  • Save Asher-/2033555 to your computer and use it in GitHub Desktop.
Save Asher-/2033555 to your computer and use it in GitHub Desktop.
to_lambda
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