From: Lars Olsson Date: 2011-04-11T18:20:35+09:00 Subject: Copying parameters to singleton class Hi list! I have a metaprogramming question that is driving me mad. I though I understood how to do it, but obviously I didn't. This is what I want to do: I want to create a class method that takes a bunch of options and returns a singleton class with those options set, class Opportunities def self.using(options) # Store options in singleton class variable @options and then return singleton class end def self.options return @options end end So that I can use: foo = Opportunities.using({:one => 1, :two: => 2, :three => 3}) bar = Opportunities.using({:four => 4, :five: => 5, :six => 6}) and then foo.options => {:one => 1, :two: => 2, :three => 3} bar.options => {:four => 4, :five: => 5, :six => 6} Please note that I don't want instances of the Opportunities class, I want two separate classes that shares the same behavior except for that they return different values for the Opportunities.options call. This really should be possible with ruby, right? /lasso