Sorry if this has been asked many times before, but I’m having a hard
finding the right keywords to search for this one.
Here’s my question… if I have a method that accepts a block and I want
call a method of the class I’m in, in that block, how do I do it? See
comment below in the example. Should make that sentence a bit clearer.
def method2 accept_block do # accept_block is not part of the Test class ... method1 # I want to call method1 from the class I'm in,
I’m getting undefined method for method1
I understand why I would be getting this error, but I don’t know how to
it. Is there a way to access the caller in the block in order to access
method of it? Kernel.caller is the closest I found, but it’s not what I
I hope this makes some sense. The example is a bit contrived, but
I get the point across.