From: Gavin Sinclair Date: 2003-01-08T12:45:42+09:00 Subject: Re: $cgi = CGI.new w/ mod_ruby dangerous or acceptable? On Wednesday, January 8, 2003, 1:45:06 PM, Tom wrote: > okay, i'm implementing singleton pattern for CGI. simple appraoch: > require 'singleton' > class CGI > include Singleton > end > now CGI.new dosen't work and one must use CGI.instance. but is there a way > just to redefine #new to do the same thing rather than having a different > method? i'd rather not have to go around changing #new to #instance? seems > like i've delt with this before but i don't remember what i came up with. #new and #instance mean different things. I think you should avoid confusing them. > also perhaps i should subclass CGI for this and create CGISingleton rather > then directly altering CGI itself. That would be better, I think. > some thoughts on the best approach to take would be greatly welcome. thanks. I can't think of any disadvantage to the subclassing approach. Gavin