Sha256: 2cb1e095cd5b00ec8c3bc2f08ca414d47599a52b667e5066fa95fa25864c10ee
Contents?: true
Size: 887 Bytes
Versions: 6
Compression:
Stored size: 887 Bytes
Contents
module Redwood ## 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.) class UpdateManager include Singleton def initialize @targets = {} self.class.i_am_the_instance self end def register o; @targets[o] = true; end def unregister o; @targets.delete o; end 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 end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
sup-0.8.1 | lib/sup/update.rb |
sup-0.7 | lib/sup/update.rb |
sup-0.5 | lib/sup/update.rb |
sup-0.6 | lib/sup/update.rb |
sup-0.4 | lib/sup/update.rb |
sup-0.8 | lib/sup/update.rb |