From: Michael Sullivan Date: 2001-11-14T01:19:16+09:00 Subject: [ruby-talk:25026] Re: attr_accessor question Well, in answer to your first question, I guess both would be nice. However I was more interested when a specific variable changes. I'd like to be able to take some action when one of a group of variables changes. Rather than write 7 or 8 accessor methods out of the 10 instance variables a class has, it would be nice to know when one of the 7 or 8 changed. I guess it might be useful to know when a class becomes "dirty" and then further know which attributes have changed. Mike On Wed, Nov 14, 2001 at 01:15:35AM +0900, Rich Kilmer wrote: > Do you need to know when a specific variable changes, or if an object > is "dirty" (any variable has changed)? > > This brings up at question: > > How do the methods attr, attr_accessor, attr_reader and attr_writer > depend on each other?...or do they? > > -Rich > > -----Original Message----- > From: Michael Sullivan [mailto:mps@blackbird.discomsys.com] > Sent: Tuesday, November 13, 2001 11:08 AM > To: ruby-talk ML > Subject: [ruby-talk:25022] attr_accessor question > > > I was wondering if when one has defined "attr_accessor" for their > instance variables if there was any way to determine when one of the > variables changes. > > I'd prefer not to write my own accessors since the attr_accessor > construct does things so nicely for me. > > Thanks, > > Mike > > -- > Michael P. Sullivan > Distributed Computing Systems, LLC Cell: 516-429-2080 > E-Mail: mps@discomsys.com http://www.discomsys.com/ > * UNIX Systems and Database Consulting, Architecture and Management * > "Failing to plan, is planning to fail... plan for the worst, hope for the best" > -- Michael P. Sullivan Distributed Computing Systems, LLC Cell: 516-429-2080 E-Mail: mps@discomsys.com http://www.discomsys.com/ * UNIX Systems and Database Consulting, Architecture and Management * "Failing to plan, is planning to fail... plan for the worst, hope for the best"