From: Steve Midgley Date: 2007-02-15T04:55:21+09:00 Subject: Re: Creating a second instance of a singleton class? dblack wrote: >I think the idea is for the object to have its own class, so if that >class ceased to be its own class, there would have to be some new >construct that was its own class, and you'd be back where you started >:-) So I don't think it's really possible in terms of the logic of >the model, and I can't think of any way to do it. > >Is it possible you could use modules to bring about the kind of thing >you're looking for? Thanks David - I think I understand what you're saying.. I'd happily settle for a *copy* of the instance's singleton class, but maybe I'm missing your point? Another way to describe what I want to do: 1) create a class "Test" 2) create an instance of Test: "test1" 3) modify test1's class definition, creating a singleton class 4) Somehow "promote" or copy this singleton class to be a full fledged class as "Test2" 5) Create an instance of "Test2" as "test2" Obviously #4 is the place where I'm stuck. B/c I'm stuck, I am (as you suggest) using module mix-in's to solve the problem, but it's less clean due to my context in the code.. It'll work, but not as nicely as if there were a method such as: Test2 = test1.dup_singleton_class test2 = Test2.new I can't see why Ruby would object inherently to copying all the class methods of a singleton into a new class object (which is all I want - just a template of the singleton class's methods - no class variables or whatnot). Thanks for the insight, Steve