From: Ryan Pavlik Date: 2003-02-18T03:55:12+09:00 Subject: Re: How to test for existence of instance variable? On Tue, 18 Feb 2003 03:33:53 +0900 Brian Candler wrote: > How can I make it test that the instance variable is uninitialised, so > I can prevent a warning? This is what I am trying to do: With "defined?" like any other variable: > class Foo > attr_reader :things > def add_thing(n) if not defined? @things > @things = [] > end > @things << n > end > end -- Ryan Pavlik "You mean easily pawned valuable crystal orb thingie." - 8BT