From: Stefan Rusterholz Date: 2008-05-23T09:29:19+09:00 Subject: Re: customized serialization unreliable???? sayoyo Sayoyo wrote: > Hi, > > I have a strange problem with the customized serialization... > I have a large object which is built by several classes and each class > has its own marshal_dump and marshal_load, like: > > class YYY > attr_reader :data, :version > > def initialize > @data = "different objects" > @version = 1 > end > > def marshal_dump() > return [@version,@data] > end Your problems most likely are caused by you returning an array instead of a String. I'm surprised Marshal doesn't complain. class Foo def marshal_dump Marshal.dump([@version, @data]) end def marshal_load(data) @version, @data = *Marshal.load(data) end ... end This works here quite well without any random outtakes. At least I haven't yet hit one. Regards Stefan -- Posted via http://www.ruby-forum.com/.