Class: Hootenanny::Correspondent
- Inherits:
-
Object
- Object
- Hootenanny::Correspondent
- Defined in:
- lib/hootenanny/correspondent.rb
Class Method Summary collapse
Instance Method Summary collapse
- #broadcast ⇒ Object
-
#initialize(topic, options = {}) ⇒ Correspondent
constructor
A new instance of Correspondent.
Constructor Details
#initialize(topic, options = {}) ⇒ Correspondent
Returns a new instance of Correspondent.
7 8 9 10 11 |
# File 'lib/hootenanny/correspondent.rb', line 7 def initialize(topic, = {}) self.topic = topic self.synchronizer_class = [:synchronizer] || Hootenanny.config.default_synchronizer end |
Class Method Details
.broadcast(topic, options = {}) ⇒ Object
13 14 15 16 17 |
# File 'lib/hootenanny/correspondent.rb', line 13 def self.broadcast(topic, = {}) correspondent = new(topic, = {}) correspondent.broadcast end |
Instance Method Details
#broadcast ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/hootenanny/correspondent.rb', line 19 def broadcast subscriptions.all? do |subscription| synchronizer_class.sync(subscriber: subscription.subscriber, digest_secret: subscription.digest_secret, topic: topic.url) end end |