From: "David A. Black" Date: 2005-08-26T22:17:50+09:00 Subject: Re: Circular dependecy on classes Hi -- On Fri, 26 Aug 2005, Robert Klemme wrote: > 2005/8/26, Derek Wyatt : >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> >> I think you're simply using an instance variable where a method is >> what you want. Take advantage of the runtime compile/binding that >> you're currently having problems with. Do this instead: >> >> class Solder >> ~ def can_upgrade_to >> ~ [Knight] >> ~ end >> end >> >> And your problems go away. You don't have to open it up later. If >> you want it private, you can simply make it private. > > Doesn't solve the OP'S problem because it was about dependencies: > Knight has to be defined when it is used. As long as it's defined before the method is called it should be OK: class C def can_upgrade_to [D] end end class D end p C.new.can_upgrade_to[0].new # # David -- David A. Black dblack@wobblini.net