Is there any way to get a list of the arguments passed to a method’s caller? I am aware of Kernel.caller, but it seems like it just gives a method name. I would like something like this:
class Test
def test1(x, y)
test2
end
end
class Test2
def test
# here I’d like to have an Array containing two 2’s (the
# values passed to Test.test1)
end
end
Is there any way to get a list of the arguments passed to a method’s
caller? I am aware of Kernel.caller, but it seems like it just gives a
method name. I would like something like this:
class Test
def test1(x, y)
test2
end
end
class Test2
def test
# here I’d like to have an Array containing two 2’s (the
# values passed to Test.test1)
end
end
Test.new.test1(2, 2)
If you know the argument names you might be able to hack something together
with set_trace_func. But why don’t you just pass them on?
Is there any way to get a list of the arguments passed to a method’s
caller? I am aware of Kernel.caller, but it seems like it just gives a
method name.
If you know the argument names you might be able to hack something together
with set_trace_func. But why don’t you just pass them on?