>>>>> "A" == Anton V Kondakov <anton / webstroy.ru> writes:

A> 1. How can i make instance method from  string?

A> 2. How can i get ruby method name for  function?

pigeon% cat uu.c
#include <ruby.h>

static VALUE
uu_mymethod(VALUE self)
{
    char *name = rb_id2name(rb_frame_last_func());
    return rb_str_new2(name);
}

void Init_uu()
{
    VALUE uu = rb_define_class("Uu", rb_cObject);
    rb_define_method(uu, "mymethod", uu_mymethod, 0);
    rb_funcall(uu, rb_intern("attr"), 2, rb_str_new2("name"), Qtrue);
}
pigeon% 

pigeon% ruby -ruu -e 'a = Uu.new; a.name = 12; p a.name; p a.mymethod'
12
"mymethod"
pigeon% 


Guy Decoux