I’m just getting started with meta-programming, and am wondering if there’s a way to view method chains similar to class ancestral chains?
For example, imagine I have a method that looks like this:
def method_a
method_b
end
method_b
# ..
end
If I call method_a like so:
method_a
It should run method_b
Is there a way from within method_b to determine that method_a was responsible for calling it?
Take a look at
Kernel#caller, which should give you the information you want.