How are methods being excecuted?

S

Saladin Mundi

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top