Ruby function calling c

In this simple example, if I assign two Ruby functions to call the same
C function:

rb_define_method(m_rbTask, “prefix=”, RUBYCAST(rb_prefix_set), 1);
rb_define_method(m_rbTask, “scratch=”, RUBYCAST(rb_prefix_set), 1);

is there a way in rb_prefix_set to determine if the user used prefix= or
scratch=?

Thanks,
Justin

On Nov 21, 2007, at 06:49 , Justin T. wrote:

In this simple example, if I assign two Ruby functions to call the
same
C function:

rb_define_method(m_rbTask, “prefix=”, RUBYCAST(rb_prefix_set), 1);
rb_define_method(m_rbTask, “scratch=”, RUBYCAST(rb_prefix_set), 1);

is there a way in rb_prefix_set to determine if the user used
prefix= or
scratch=?

def my_caller
caller[0][/`(.*)’/, 1]
end

And use rb_funcall() to call my_caller.

On Nov 21, 2007 3:49 PM, Justin T. [email protected] wrote:

In this simple example, if I assign two Ruby functions to call the same
C function:

rb_define_method(m_rbTask, “prefix=”, RUBYCAST(rb_prefix_set), 1);
rb_define_method(m_rbTask, “scratch=”, RUBYCAST(rb_prefix_set), 1);

is there a way in rb_prefix_set to determine if the user used prefix= or
scratch=?

See rb_frame_last_func().

Laurent

Thanks for your help. This is exactly what I needed.

Justin