4

How does one convert a bloc to a lambda in jruby? Basically what is the jruby answer for this: Ruby: convert proc to lambda??

Community
  • 1
  • 1
Schneems
  • 14,918
  • 9
  • 57
  • 84

1 Answers1

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
pje
  • 21,801
  • 10
  • 54
  • 70
  • A [related question](http://stackoverflow.com/questions/7369553/jruby-is-ruby-lambda-syntax-not-an-important-consideration), and a [possibly helpful one](http://stackoverflow.com/questions/4755900/how-to-make-jruby-1-6-default-to-ruby-1-9). – pje Nov 05 '12 at 21:35