From: ts Date: 2001-06-22T00:30:07+09:00 Subject: [ruby-talk:16712] Re: how to call super from singleton method? >>>>> "A" == Andi Riedl writes: A> is there another way to obtain the the underlying A> class method from within the singleton? OK, I've finally understood what you want, sorry for the previous message. Try this : pigeon% cat tt.c #include #include VALUE myInspect (VALUE self) { return rb_str_concat(rb_str_new2("myInspect : "), rb_funcall(self, rb_intern("inspect_old"), 0)); } VALUE tt_protect(y) VALUE y; { return rb_funcall(y, rb_intern("inspect_old"), 0); } int main() { VALUE x, y, z; int state; ruby_init(); x = rb_hash_new(); z = rb_hash_new(); rb_alias(rb_singleton_class(x), rb_intern("inspect_old"), rb_intern("inspect")); rb_define_singleton_method(x, "inspect", myInspect,0); /* call now: */ y = rb_funcall(x,rb_intern("inspect"),0); printf ("x <%s>\n",STR2CSTR(y)); state = 0; y = rb_protect(tt_protect, z, &state); if (state) { y = rb_inspect(rb_gv_get("$!")); printf ("FAILED <%s>\n",STR2CSTR(y)); } return 0; } pigeon% pigeon% tt x FAILED <#> pigeon% Guy Decoux