lib/celluloid/notifications.rb in celluloid-0.11.1 vs lib/celluloid/notifications.rb in celluloid-0.12.0.pre

- old
+ new

@@ -1,7 +1,23 @@ module Celluloid module Notifications + def self.notifier + Actor[:notifications_fanout] or raise DeadActorError, "notifications fanout actor not running" + end + + def publish(pattern, *args) + Celluloid::Notifications.notifier.publish(pattern, *args) + end + + def subscribe(pattern, method) + Celluloid::Notifications.notifier.subscribe(Actor.current, pattern, method) + end + + def unsubscribe(*args) + Celluloid::Notifications.notifier.unsubscribe(*args) + end + class Fanout include Celluloid trap_exit :prune def initialize @@ -60,25 +76,8 @@ def matches?(subscriber_or_pattern) self === subscriber_or_pattern || @pattern && @pattern === subscriber_or_pattern end - end - - class << self - attr_accessor :notifier - end - self.notifier = Fanout.new - - def publish(pattern, *args) - Celluloid::Notifications.notifier.publish(pattern, *args) - end - - def subscribe(pattern, method) - Celluloid::Notifications.notifier.subscribe(Actor.current, pattern, method) - end - - def unsubscribe(*args) - Celluloid::Notifications.notifier.unsubscribe(*args) end end end