From: Leon Theremin Date: 2010-05-08T23:14:33+09:00 Subject: Re: Modify Class Instance Inside Another Class (scope problem?) Josh Cheek wrote: > You have an instance method called cards which returns an initialized > set of > cards. When you say "p g.cards" at the end, you are calling this method, > so > you are simply calling this method, so you are getting the returned > value of > Game#cards, the value returned by the cards method that you have > defined. > However, your @cards instance variable is initialized when you say > g.assign_values, but that isn't what you are printing out. > > To see the difference: > > g = Game.new > p g.cards > g.assign_values > p g.cards > p g.instance_variable_get("@cards") So basically, my method was working as intended, but I was looking for the result in the wrong place. Seems like an obvious mistake (name conflict) to avoid now. Thank you! -- Posted via http://www.ruby-forum.com/.