From: Chris Pine Date: 2003-12-16T14:42:39+09:00 Subject: Re: Subclassing Array ----- Original Message ----- From: "Hans Fugal" > With a slight modification what you offered would work: > > class SimilArray > def initialize(ary) > @ary=ary > end > include Notifier > def method_missing(:method,*args,&blk) > @ary.send(:method,*args,&blk) > notify # this is what's different > end > end > > But it would always notify even on read-only operations, and so it's > wasteful. But I could check by name for writing operations. ------------------------------ You could also test to see if the array has changed (clone it before sending the message): is it the same size with the same elements in the same order? If so, then notify. Chris Pine