From: tamc2@... (Tom Counsell) Date: 2004-09-21T21:34:41+09:00 Subject: Marshalling objects that include 'Singleton' Hello Can someone help me? I'm trying to Marshal a class that includes 'Singleton' but all I get upon loading is an empty object. e.g: require 'singleton' class SingleHash < Hash include Singleton end o = SingleHash.instance o[1] = 'hello world' # Save the object to file File.open( 'test', 'w' ) { |file| Marshal::dump( o, file ) } # Leave quit # Restart ruby # Redefine SingleHash class o = nil o = File.open( 'test' ) { |file| o = Marshal::load( file ) } puts o[1] #=> nil ? Why didn't the contents get written to the file? Apologies if it is obvious, but why didn't the contents of the class get written to / reloaded from the file? Is there any way to make this work? Many thanks Tom