From: Mirko Viviani Date: 2009-07-23T01:07:13+09:00 Subject: Re: Instantiating classes / sharing data between classes --0016364d226139eb4a046f4d90d9 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable create a class variable? @@modalities ? p.s. don't know if ok... 2009/7/22 Trevoke > I think this is what I want to do (maybe I'm thinking about it wrong): > > a =3D Doctor.new > b =3D Doctor.new > > I want both 'a' and 'b' to have access to: > modalities =3D ['US', 'CR', 'CT', 'MR'] > > The array 'modalities' is not hard-coded, but generated from a > database query. I don't want to query the database every time I create > a new instance of Doctor - so how can I do it so that every instance > of Doctor shares the same array, only created once? > > Is this the part where 'modules' and 'classes' come into question and > interact? > > --=20 -- Mirko Viviani -- GPG-PGP Public Key: 0xE4E8FAB1 Fingerprint: 14D3 A373 E926 7737 DF32 502B A4C4 1CE2 E4E8 FAB1 *********************************************** "=93Machines take me by surprise with great frequency.=94 A. Turing --0016364d226139eb4a046f4d90d9--