问题
How does one convert a bloc to a lambda in jruby? Basically what is the jruby answer for this: Ruby: convert proc to lambda??
回答1:
As long as you're running jruby 1.9-compatibly (e.g. jruby --1.9 -S irb
), it should be the same:
my_proc = proc { |x| x }
my_lambda = lambda &my_proc
my_lambda.lambda?
# => true
来源:https://stackoverflow.com/questions/13239338/convert-bloc-to-lambda-in-jruby