Guys, how are you?
I’m stuck thinking about how can I save the state of a class. I want to
save the class variables of some classes. Do I have to require to
metaprogramming for this? I mean: save those variables in an object,
then dump it marshaling and then re-construct a class from that object
when is loaded. I’ll try to explain the situation in an example:
@@quantity = 5
@@quantity = n
Dog.change_quantity = 99
File.open(‘anyfile.mrs’, ‘w+’) do |f|
Dog.change_quantity = 50
#I want to show 99
So as you can see I’m very confused. This is probably not the way to do
what I want, do you have any advice for me? The objetive is to save the
“state” of a class, save the values of all his class variables. Thanks.