class Redwood::UpdateManager

Classic listener/broadcaster paradigm. Handles communication between various parts of Sup.

Usage note: don't pass threads around. Neither thread nor message equality is defined anywhere in Sup beyond standard object equality. To communicate something about a particular thread, just pass a representative message from it around.

(This assumes that no message will be a part of more than one thread within a single “view”. Luckily, that's true.)

Public Class Methods

new() click to toggle source
# File lib/sup/update.rb, line 17
def initialize
  @targets = {}
end

Public Instance Methods

register(o;) click to toggle source
# File lib/sup/update.rb, line 21
def register o; @targets[o] = true; end
relay(sender, type, *args) click to toggle source
# File lib/sup/update.rb, line 24
def relay sender, type, *args
  meth = "handle_#{type}_update".intern
  @targets.keys.each { |o| o.send meth, sender, *args unless o == sender if o.respond_to? meth }
end
unregister(o;) click to toggle source
# File lib/sup/update.rb, line 22
def unregister o; @targets.delete o; end