From: ts Date: 2002-04-24T17:06:54+09:00 Subject: Re: Two questions about extension >>>>> "A" == Anton V Kondakov 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 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