Paul Murton wrote: > I have a whole load of objects which I would like to periodically dump > as YAML. However, in order to save on resources, I would prefer to only > dump those whose instance variables have changed since the last dump. > > Is it possible to somehow 'mark' an object when the value any of its > instance variables is changed? > For the more "magical" way, you could play around with set_trace_func to monitor setters. Would probably be horribly, terribly slow. It's probably best to have your objects trace changes by design. Modify the Object class to have a #dirty? and #clean! method, and alias / redefine the #attr_writer method to generate methods that will set the dirty flag when used? David Vallner