------ art_143737_23813965.1169283125542 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Change update_timer to: def update_timer self.timer ime.now end Mark On 1/20/07, CBlair1986 <CBlair1986 / gmail.com> wrote: > > Hi all! I've got a question, and I hope it can be answered. I'm > currently using attr_accessor to set up a list of variables that are > accessed throughout a class, and I'm running into trouble. > > See, I've got something like the following: > > class Test > attr_accessor :timer > def initialize > @timer ime.now > end > > def update_timer > timer ime.now > end > end > > But, as simple as it looks, it doesn't work. I'll make a new Test > object and call update_timer all I want, and it won't update. It seems > a bit counter-intuitive. I've made an accessor for a variable that I > declare when initialized, and then go to change it, and it doesn't > work. > > However, if I change the 'timer' in update_timer to '@timer', it works > perfectly fine. Why is this? > > Thank you! > > > -- Mark Van Holstyn mvanholstyn / gmail.com http://lotswholetime.com ------ art_143737_23813965.1169283125542--