From: "Ara.T.Howard" Date: 2004-03-24T23:14:29+09:00 Subject: Re: How to avoid duplicate object creations? > "Stig Sandbeck Mathisen" schrieb im Newsbeitrag > news:90lekrj4kn4.fsf@talisker.nsc.no... > > > > I have a program that will create a lot of objects, mainly of type > > SomeDocumentation::Host and SomeDocumentation::Role. > > > > Since the Role objects typically create a lot of Host objects, and the > > other way around, I tried to be clever, and look up objects that already > > exists with the same value of "name", since the initialize reads a bit > > from disk. check out http://www.codeforpeople.com/lib/ruby/multiton/ a 'multiton' is a 'singleton' based on the args passed to the ctor. it may help you. -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328 | URL :: http://www.ngdc.noaa.gov/stp/ | TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done ===============================================================================