Sha256: c2648b635d1a83f327584a391aad5a4469a3fb4017a8f687c94380f45e7f6da4
Contents?: true
Size: 847 Bytes
Versions: 1
Compression:
Stored size: 847 Bytes
Contents
module PubsubNotifier module Proxy def self.included(klass) klass.extend ClassMethods end module ClassMethods def subscribe(subscriber_name, options = {}) subscriber = subscriber_name.to_s.constantize broadcaster = ( options.delete(:async) ? broadcasters[:async] : nil ) || broadcasters[:default] broadcaster.configure(options) if broadcaster.respond_to?(:configure) pubsub.subscribe(subscriber, broadcaster: broadcaster) end def pubsub @_pubsub ||= ::PubsubNotifier::Pubsub.new end private def broadcasters Wisper.configuration.broadcasters end end def broadcast(event) pubsub.call(event, self) end alias pubilish broadcast private def pubsub self.class.pubsub end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pubsub_notifier-0.1.0 | lib/pubsub_notifier/proxy.rb |