From: Carlos Date: 2004-03-09T04:23:29+09:00 Subject: Re: How to remove an instance variable ? [Its Me , 2004-03-08 19.54 CET] > So "@a" refers to (and creates if needed) an instance variable. > > Is there some method to get rid of an instance variable (not just set to > nil)? $ ri -T remove_instance_variable ---------------------------------------- Object#remove_instance_variable obj.remove_instance_variable(symbol) => obj ------------------------------------------------------------------------ Removes the named instance variable from _obj_, returning that variable's value. class Dummy attr_reader :var def initialize @var = 99 end def remove remove_instance_variable(:@var) end end d = Dummy.new d.var #=> 99 d.remove #=> 99 d.var #=> nil