Hi Jeremy, That's a pretty good idea! Could you file a bug on the tracker so that we do not forget about it? Thanks, Laurent On May 12, 2009, at 10:18 AM, Jeremy Voorhis wrote:
Hello,
I've been learning Cocoa, Objective-C and macruby in tandem and I was just wondering, are there any plans to integrate the key-value observing protocol with the attr_accessor family of methods? With a little experimentation, I found KVO is definitely possible with macruby, but the syntax is less than ideal (transcript made with the 0.4 release).
~ % macirb
class Notifier attr_accessor :value end => nil class Observer def observeValueForKeyPath(path, ofObject:object, change:change, context:context) puts change end end => nil n = Notifier.new => #<Notifier:0x8005e91a0> n.addObserver(Observer.new, forKeyPath:'value', options:0, context:nil) => nil n.value = 42 => 42 n.setValue 42 {"kind"=>1} => nil
Best,
Jeremy Voorhis _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel