From: Trans Date: 2007-03-09T13:25:10+09:00 Subject: Re: Facets / Multiton 2.0.0 On Mar 8, 9:14 pm, ara.t.how...@noaa.gov wrote: > On Fri, 9 Mar 2007, Trans wrote: > > [ C R E D I T ] > > > Ara T. Howard (Original Code) > > Trans (Improvements) > > ^^^^^^^^^^^^ > ^^^^^^^^^^^^ > ^^^^^^^^^^^^ undoubtedly, the code was bit rotting, but what? Most notably and interface change. From the docs: # == Previous Behavior # # In previous versions of Multiton the #new method was made # private and #instance was used in its stay --just like Singleton. # But this has proved less desirable for Multiton since Multitions can # have multiple instances, not just one. # # So instead Multiton now defines #create as a private alias of # the original #new method (just in case it is needed) and then # defines #new to handle the multiton, and #instance is provided # as an alias for it. # # If you must have the old behavior, all you need do is re-alias # #new to #create and privatize it. # # class SomeMultitonClass # include Multiton # alias_method :new, :create # private :new # ... # end # # Then only #instance will be available for creating the Multiton. Another example: k = begin Marshal.dump(k) rescue TypeError k end k is the args passed to the initializer, but marshalled to use as a hash key for caching. Also, I simplied how the METHOD_NEW_HOOK is used so that it is always defined. Think that's about it. T.