Is it possible to make a class unavailable?

(Barry) #1

Is it possible to make a class unavailable via the C interface?

The opposite of rb_define_class_under?

I'd like to rb_undefine_class_under.

Since my class has become unavailable during runtime...

Thanks

If they want peace, nations should avoid the pin-pricks that precede cannon shot
- Napoleon Bonaparte

(Gyoung-Yoon Noh) #2

Hi,

If you find something like 'undef' on class, you'd better consider using
Object's non-public class method 'remove_const'.

$ irb
irb(main):001:0> class K; end
=> nil
irb(main):002:0> Object.send(:remove_const, :K)
=> K
irb(main):003:0> K
NameError: uninitialized constant K
        from (irb):3

Regards,

···

On 8/29/05, Barry <evansbj@telusplanet.net> wrote:

Is it possible to make a class unavailable via the C interface?

The opposite of rb_define_class_under?

I'd like to rb_undefine_class_under.

Since my class has become unavailable during runtime...

Thanks

If they want peace, nations should avoid the pin-pricks that precede
cannon shot
- Napoleon Bonaparte

--
http://nohmad.sub-port.net