From: Manny Calavera Date: 2009-10-27T20:05:12+09:00 Subject: Re: UnMarshal without source file Il Sun, 25 Oct 2009 16:28:50 +0100, Brian Candler verg�: > Manny Calavera wrote: >> I'm looking for a STANDARD methods to unmarshal a class istance without >> have source file. > > How would you want it to work? For example, if it contains an object of > class Foo::Bar, and such class does not exist at runtime, would you want > it to create a fresh Foo::Bar class? Such class would have no methods of > course, apart from those inherited from Object. My idea was: class Klass def method "It work!" end end class MyMarshal def MyMarshal.dump ist s="class\ndef method\n\"It work!\"\nend\nend\n" s<< "�" s<< Marshal.dump(ist) s end def MYMarshal.load s array=s.split/�/ eval array[0] Marshal.load array[1] end end But something more STANDARD -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/