Topic: Customized marshalling of objects?
Is there a way to customize the Marshal#dump so that it ignores certain fields in my objects? I know I can implement the methods marshal_dump and marshal_load on my classes. But then I take full responsibility and cannot take any advantage of the default marshalling really. YAML#dump has the nice feature that you can implement the method to_yaml_properties. That makes YAML only dump the specified fields. Is there something similar for Marshal#dump?
My question is Rails-related actually. So perhaps there are other ways to do what I want. I simply want to store some of my own objects in the session. They contain some lazy-evaluated fields that are purely there for performance and 'ease-of-coding' reasons. I want to avoid marshalling those fields because they are not needed. Even worse some of them cannot be marshalled at all (e.g. a reference to a model class). How would you normally deal with this?