[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

is it possible to remove a constant?

sayoyo Sayoyo

1/17/2006 8:32:00 PM

Hi,

I wonder is it is possible to remove a constant at runtime. We can
create a constant with "const_set", is there any functions which will
allows us to remove or delete a constant?

Thanks you very much

Sayoyo

1 Answer

Dale Martenson

1/17/2006 9:48:00 PM

0

Look at Module#remove_const that may do what you want.

---------------------------------------------------------------------------------
remove_const(sym) => obj
---------------------------------------------------------------------------------
Removes the definition of the given constant, returning that constant's
value. Predefined classes and singleton objects (such as true) cannot
be removed.