From: Joel VanderWerf Date: 2005-06-23T13:45:05+09:00 Subject: Re: [ANN] traits-0.3.0 Devin Mullins wrote: > I'm not sure I'd ever use it, but if you're looking for ideas, I think a > protocol by which to register observers would be pretty neat. > > *reads email about 'observable' library* > > I mean, uh, an improvement over the observable library. Something like > this, perchance: > > class C > has :a, :observers => true > has :b, :validators => true > end > > c = C.new > c.observe(:a) { |old,new| > blah > } > c.observe(:a) { |old,new| > additional_blah > } > c.validate(:b) { |old,new| > blah? > } > > If not blah?, then b is not changed. Currently, observers just get notified after the action has happened. A pre-action hook might be useful. I'll look into it next time I update 'observable'.