[MacRuby-devel] Key Value Observing module

Caio Chassot lists at caiochassot.com
Mon Nov 29 12:32:46 PST 2010


On 2010-11-29, at 14:50 , Alan Skipp wrote:
> 
> There's a brief article here
> http://www.oreillynet.com/ruby/blog/2006/01/ruby_design_patterns_observer.html
> 
> The procedure for setting up observers is quite different to KVO and I imagine it has different advantages/disadvantages to KVO, though I must admit I'm not particularly familiar with ruby observer pattern myself.

I'd love to hear more, too. If someone else can chime in.

I'm well familiar with observers in Rails, but they're very particular to ActiveRecord and rely on existing callbacks that AR provides during the life-cycle of a record.

More generally you can implement value observers in ruby by monkey-patching the setter methods (method swizzling for the Objective-C-minded), which I would not be surprised at all to hear is how KVO is implemented in ObjC internally.



More information about the MacRuby-devel mailing list