def test_method
result = []
result << yield # How to get the line number of where next was invoked in this block
puts caller[0] # Gives the line number of another_method
result
end
def another_method
a = 1
b = 2
test_method do
next if a == 1
next if b == 200
end
end
In the above code, yield returns at next if a == 1, how to get the line number of source code where next was invoked in the given block from the test_method?