From: Joe Laughlin Date: 2004-11-11T03:13:30+09:00 Subject: automatically call function on attribute set I have a class that represents an airplane. This class has a bunch of data members: x/y/z positions, x/y/z velocities, pitches, rolls, etc. What I did is let the user configure what different attributes the airplane had in a YAML config file, then have the airplane class read in that file and setup attr_accessors for each attribute in the file. I have another object (call it airplane_drawing) that is responsible for drawing this airplane on the screen. It needs to have access to some of the attributes of the airplane, and it needs have some of its own attributes changed whenever airplane's attributes changes. What is the best way to get airplane_drawing to be notified whenever some attribute of airplane is changed? Should I have a thread (or similar) that checks the airplane object to see if anything's changed? I hope I've explained this well enough for people to understand... I feel like this is a fairly common thing to do, but I'm not sure of the best way to do it. Thanks, Joe