# How are methods being excecuted?

**URL:** <https://www.ruby-forum.com/t/how-are-methods-being-excecuted/122189>\
**Category:** Ruby\
**Created:** [December 5, 2007, 11:49am UTC](https://www.ruby-forum.com/t/how-are-methods-being-excecuted/122189 "2007-12-05T11:49:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![saladinmundi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@saladinmundi](https://www.ruby-forum.com/u/saladinmundi)\
**Post date:** [December 5, 2007, 11:49am UTC](https://www.ruby-forum.com/t/how-are-methods-being-excecuted/122189/1 "2007-12-05T11:49:45Z")

</div>

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  
Ruby.  
If we have something like:

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

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  
x.

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

sala
