From: Rein Henrichs Date: 2010-06-08T08:05:10+09:00 Subject: Re: Defining struct in a class On 2010-06-07 15:16:33 -0700, William Song said: > How can I properly define a struct in a class? > > If I have > > class Cards > Card = Struct.new(:suit, :number) > @cardsOnHand=[] > > @cardsOnHand.push(Card.new("S","5")) > end > > This will give me an error message saying the push is not defined for > NilClass. How should I fix this? The error you reported has nothing to do with your Card struct. Besides which, your code works for me as is. -- Rein Henrichs http://puppetlabs.com http://reinh.com