[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Singletons and Marshalling

Charles Hixson

11/14/2003 3:37:00 AM

Does anyone know how singleton's and marshalling interact?

In particular, I want to have my singleton class be able to dump and
load (and be saved on a file). So I'm wondering if there are any
methods to be implemented that would enable this.

In particular, I'm composing a kind of container class that will contain
either an array, a hash, or possibly both of values. Dumping it should
be basically dumping all the members of the hash/array (plus a few
more), and restoring should append the contents of the being-restored
value to the one in memory. (Duplicates aren't a problem as they'll
just be dropped.)

If this can't be done, there are other approaches, but as they involve
things like private class variables & classes that are only used
internally as a cache.... well, the other approach looks cleaner, if
it's possible.