From: 7stud -- Date: 2011-04-13T09:08:56+09:00 Subject: Re: Copying parameters to singleton class Robert K. wrote in post #992088: > > or this way > > class Opportunities > class < attr_reader :options > end > > def self.using(opts) > Class.new(self).tap do |cl| > cl.instance_variable_set '@options', opts.freeze > end > end > end > > The using() method in your last solution can be simplified: def self.using(opts) Class.new(self) do @options = opts.freeze end end And this bit in my last post: singleton.singleton_class.class_eval do #<---SOLUTION*** def options @options end end is equivalent to: singleton.instance_eval do def options @options end end -- Posted via http://www.ruby-forum.com/.