YAML and class variables

R

Rick Ashton

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
 
R

Robert Klemme

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,222
Messages
2,571,137
Members
47,754
Latest member
Armand37T7

Latest Threads

Top