# Custom serialization scheme

**URL:** <https://www.ruby-forum.com/t/custom-serialization-scheme/94601>\
**Category:** Ruby\
**Created:** [May 8, 2006, 8:31pm UTC](https://www.ruby-forum.com/t/custom-serialization-scheme/94601 "2006-05-08T20:31:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [May 8, 2006, 8:31pm UTC](https://www.ruby-forum.com/t/custom-serialization-scheme/94601/1 "2006-05-08T20:31:59Z")

</div>

I have an object with one attribute that is unserializable (due to it’s  
containing a Proc).

I am trying to figure out how to do the customized serialization  
routines for it.

Assume that my attribute that I don’t want to serialize is named  
@transient. If I wanted to make sure that @transient didn’t get dumped,  
couldn’t I just do:

def marshal\_dump  
@transient = nil  
self.\_dump  
end

I’m basically wanting to take advantage of the built-in serialization  
but exclude one attribute from it.

Would I have to also create a marshal\_load method in this case?

Am I required to come up with a custom marshaling and unmarshaling  
scheme for _all_ of the N-1 attributes that I _do_ want to have be  
serializable, in order to just exclude this one?

Thanks,  
Wes
