--tThc/1wpZn/ma/RB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

dblack [2006-02-15 7:38]:

> > 1.) cFoo = rb_define_class ("Foo", rb_cObject);
> > 2.) rb_define_singleton_method (cFoo, "inherited", ...)
> > 3.) rb_undef_method (rb_singleton_class (foo, "inherited"))
> > 4.) rb_define_class (c, "Bar", cFoo)
> > 
> > The fourth call will lead to an error saying:
> >   "Undefined method 'inherited'"
> > 
> > Is there a way to restore the default Class.inherited method on Foo, so
> > I can still inherit from Foo, but not call the original inherited method
> > I defined in step 2?
>
> A semi-guess, but I think you could use rb_remove_method instead of
> rb_undef_method.  On the Ruby side, at least (and I assume the C
> side), remove_method removes the method from the class or module but
> still allows earlier ones to be called, whereas undef_method causes
> instances (singleton or otherwise) not to be able to call the method
> at all.

Thanks, rb_remove_method() does the trick :)

Regards,
Tilman

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

--tThc/1wpZn/ma/RB
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFD9vdH27uLisrW2w8RAlXaAJ99yjjhPqhv26oSABBRWsMwc0WSnACeNnPA
DUzCbmht2uECkClA51HHOLMPV
-----END PGP SIGNATURE-----

--tThc/1wpZn/ma/RB--