Initialization after YAML load?

L

Larry Fast

I'm saving and restoring a large tree structure using YAML. What I've
read is that the Initialize method is not called after loading.

Is there something like a post-load method within YAML that I can
override and is automatically invoked for each object created?

On a slightly related note, I've seen the to_yaml method but I'm looking
for the inverse. I want to save everything unless it's in my not_yaml
list. Does anything like this exist?

Thanks,
Larry Fast
 
J

Jano Svitok

I'm saving and restoring a large tree structure using YAML. What I've
read is that the Initialize method is not called after loading.

Is there something like a post-load method within YAML that I can
override and is automatically invoked for each object created?

On a slightly related note, I've seen the to_yaml method but I'm looking
for the inverse. I want to save everything unless it's in my not_yaml
list. Does anything like this exist?

Thanks,
Larry Fast

you can use #to_yaml_properties() - return everything except the ones
you don't want to save. Works on a per attribute basis.

J.
 
L

Larry Fast

Jano said:
you can use #to_yaml_properties() - return everything except the ones
you don't want to save. Works on a per attribute basis.

Thanks Jano,
That did the trick. As for the postload operations I'm taking a
different route.
 

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
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top