[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

YAML and class variables

Rick Ashton

1/3/2007 11:23:00 AM

Hi

When an object's .to_yaml method is used, class variables aren't
recorded. This makes sense, I guess, but how can someone then serialize
a class variable and restore it later?

Thanks!
kLy

--
Posted via http://www.ruby-....

1 Answer

Robert Klemme

1/3/2007 11:51:00 AM

0

On 03.01.2007 12:22, Rick Ashton wrote:
> When an object's .to_yaml method is used, class variables aren't
> recorded. This makes sense, I guess, but how can someone then serialize
> a class variable and restore it later?

You don't. Basically a class variable belongs to the class and that's
typically not created via some serialization mechanism (yaml, marshal)
but through code. Apart from that class variables have a whole bunch of
problems of their own so you better avoid them anyway. My 0.02 EUR...

Kind regards

robert