Getting the name of an invoked method?

Hello,

In the C Ruby API, is there a clean way to get the name of the method
which has been invoked? ie. If there is a single C function handling
multiple method calls, is there a way from C to find out which of the
methods was invoked?

The only way I’ve been able to find of doing this so far is through
poking into the internal stack, eg. rb_id2name(ruby_frame->last_func)
gives the name of the method called. This seems kind of ugly, though.
Is there a cleaner way?

Simon

Hi,

···

At Mon, 1 Sep 2003 03:26:02 +0900, Simon D. Howard wrote:

The only way I’ve been able to find of doing this so far is through
poking into the internal stack, eg. rb_id2name(ruby_frame->last_func)
gives the name of the method called. This seems kind of ugly, though.
Is there a cleaner way?

rb_frame_last_func() instead of the member of ruby_frame directly.


Nobu Nakada