From: David Vallner Date: 2006-02-08T05:58:46+09:00 Subject: Re: marshalling constants Dňa Utorok 07 Február 2006 21:39 Joel VanderWerf napísal: > Brian Buckley wrote: > class A > A1 = new > > def self.name_for_constant obj > @name_for_constant ||= {} > @name_for_constant[obj] ||= constants.find {|c| const_get(c) == obj} > end > > def _dump(limit) > self.class.name_for_constant(self) > end > > def self._load(str) > const_get str > end > end > > before = A::A1 > after = Marshal.load(Marshal.dump(before) > puts before == after # ==> true > puts before.object_id == after.object_id # ==> true Ignore the nonsensical rant that follows after the explanation about the Fixnums, I thought Brian wanted to change Marshal code for some reason. David Vallner