From: "Arno J." Date: 2007-08-17T00:42:34+09:00 Subject: Re: Subject: What *exactly* does an instance variable in the Any instance variable refers to the object currently being self at the moment. > @tl_instance = "hello ruby" self here is "main", which is the top level default object > puts @tl_instance > > def tl_method > puts "from tl_method -- @tl_instance: #{@tl_instance}" > end self here is "main" too > > tl_method > => Working as expected > class Tl_class > def tlc_method > puts "from tlc_method -- @tl_instance: #{@tl_instance}" > end > end > > Tl_class.new.tlc_method > ------------ Inside tlc.method, self is the "Tl_class.new" object, which doesn't know about any @tl_instance. -- Posted via http://www.ruby-forum.com/.