From: "Ara.T.Howard" Date: 2005-06-22T23:36:10+09:00 Subject: Re: [ANN] traits-0.3.0 On Wed, 22 Jun 2005, Ralph "PJPizza" Siegler wrote: > On Wed, Jun 22, 2005 at 09:18:13PM +0900, Ara.T.Howard wrote: >> >> URLS >> >> http://raa.ruby-lang.org/search.rhtml?search=traits >> http://codeforpeople.com/lib/ruby/traits >> >> ABOUT >> >> traits.rb aims to be a better set of attr_* methods and encourages better >> living through meta-programming and uniform access priciples. traits.rb >> supercedes attributes.rb. why? the name is shorter ;-) > > Hello Ara, > > would it be possible to have a kind of observer on traits, kind of like Apple/obc/cocoa's KVO? > > Ralph "PJPizza" Siegler can you give me a little code snippet to show how you'd like it to look? i'm imagining something like class C has 'a', 'default' => 42, 'pre' => proc{|this| puts "pre a : #{ this.a }"}, 'post' => proc{|this| puts "post a : #{ this.a }"}, end obj = C::new obj.a('forty-two') would result in pre a : 42 post a : forty-two being printed or were you thinking more like class C some_observer = SomeObserver::new has 'a', 'default' => 42, 'observer' => some_observer end and observer.notify(self, value) would be called or something? cheers. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | My religion is very simple. My religion is kindness. | --Tenzin Gyatso ===============================================================================