tags:

views:

28

answers:

1

Given the following snippet:

hash = {                  # 1
  (line = __LINE__) =>    # 2
    lambda { x }          # 3
}

Doing some inspection on jruby:

puts line # >> 2
puts hash[line].inspect >> #<Proc:0x560932fe@/tmp/test.rb:2>

Seems to differ from the standard mri:

puts line # >> 2
puts hash[line].inspect >> #<Proc:0x00007fa59733d760@/tmp/test.rb:3>

The proc appears to be on line 3 in mri, whereas in jruby, it is line 2 ... is this a bug ? Any workaround for this ?

A: 

if it differs from MRI it's probably considered a bug

rogerdpack