3 ## Classic listener/broadcaster paradigm. Handles communication between various
6 ## Usage note: don't pass threads around. Neither thread nor message equality is
7 ## defined anywhere in Sup beyond standard object equality. To communicate
8 ## something about a particular thread, just pass a representative message from
11 ## (This assumes that no message will be a part of more than one thread within a
12 ## single "view". Luckily, that's true.)
19 self.class.i_am_the_instance self
22 def register o; @targets[o] = true; end
23 def unregister o; @targets.delete o; end
25 def relay sender, type, *args
26 meth = "handle_#{type}_update".intern
27 @targets.keys.each { |o| o.send meth, sender, *args unless o == sender if o.respond_to? meth }