From: Sebastian Hungerecker Date: 2007-09-02T17:13:50+09:00 Subject: Re: attr_reader 7stud -- wrote: > Logan Capaldo wrote: > > Nope. It's just that an undefined instance variable is treated as > > though it were nil. > > Then why isn't song.fake treated as though it were nil? song.fake isn't an instance variable, it's a method (well actually it's not, it's nothing, but if it did exists, it'd be a method). attr_reader :duration creates the method duration, which returns the instance variable @duration, even if the latter doesn't exist yet. song.fake throws an error because there is no method fake, independantly of whether or not an instance variable @fake exists. song.instance_variable_get "@fake" would return nil. HTH, Sebastian -- Jabber: sepp2k@jabber.org ICQ: 205544826