Sha256: dd811d63f7cf894aaa4a45968bf3ecc884de4f6a8e50bb0fd6b5fe83afc3fbe6

Contents?: true

Size: 411 Bytes

Versions: 5

Compression:

Stored size: 411 Bytes

Contents

module Redwood

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

5 entries across 5 versions & 1 rubygems

Version Path
sup-0.0.8 lib/sup/update.rb
sup-0.0.7 lib/sup/update.rb
sup-0.1 lib/sup/update.rb
sup-0.2 lib/sup/update.rb
sup-0.3 lib/sup/update.rb