How are methods being excecuted?

Hi everyone,

I’m working on a method which should manipulate the excecution of the
method body.
Therefore I need to know, how/where a Ruby method is called and
how/where the method body is excecuted. Its all done on the C-level of
If we have something like:

class z
def x()
k = “John”
puts “Hello #{k}”
t =

I found out, that rb_call/rb_funcall have something to do with the
execution of a method. But they are only calling the internal C-methods.
So the ID mid from rb_call(VALUE klass, VALUE recv, ID mid, int argc,
const VALUE *argv, int scope) refers C-Methods but not also to my method

So I don’t know how to recognize when my (Ruby) method x is called.
Additionally I don’t know which C-Method really executes (not calls) my
method x. So which method goes through the method body of x and makes
the setting of the local variable k and the forwarding of the string
Hello… to the method puts.

It would be so helpful if someone has got tips for me

thanks in advance