Forum: Ruby Initialization after YAML load?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
52dd2594d15023f98d4537e0086e5924?d=identicon&s=25 Larry Fast (lfast)
on 2007-07-25 20:46
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
97550977337c9f0a0e1a9553e55bfaa0?d=identicon&s=25 Jano Svitok (Guest)
on 2007-07-26 00:46
(Received via mailing list)
On 7/25/07, Larry Fast <lfast@mdsi.ca> wrote:
> 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.
52dd2594d15023f98d4537e0086e5924?d=identicon&s=25 Larry Fast (lfast)
on 2007-07-26 05:51
Jano Svitok wrote:
> 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.
This topic is locked and can not be replied to.