From: Edwin van Leeuwen Date: 2005-11-28T22:03:02+09:00 Subject: Re: Object access heirarchies leslie wrote: > What I want to know is: what's the best way? I had globals $player, > $world, $map > earlier and that makes things a bit easier but it also makes me nervous > (perhaps just because I have been anti-global-indoctrinated for 20 years > now) You could do it with class variables: class Map private_class_method :new @@map = nil def Logger.create @@map = new unless @@map @@map end end Now you can call from each object that needs the map object: map=Map.create and it will create a new one if none exists, or send you the already created object. Edwin -- Posted via http://www.ruby-forum.com/.