Class: WebsocketMessaging::MulticastNotifier
- Inherits:
-
Object
- Object
- WebsocketMessaging::MulticastNotifier
- Defined in:
- lib/websocket_messaging/multicast_notifier.rb
Instance Attribute Summary collapse
-
#notifiers ⇒ Object
readonly
Returns the value of attribute notifiers.
Instance Method Summary collapse
-
#initialize(channel_ids, notifier_builder) ⇒ MulticastNotifier
constructor
A new instance of MulticastNotifier.
- #notify(message) ⇒ Object
Constructor Details
#initialize(channel_ids, notifier_builder) ⇒ MulticastNotifier
Returns a new instance of MulticastNotifier.
5 6 7 8 9 |
# File 'lib/websocket_messaging/multicast_notifier.rb', line 5 def initialize(channel_ids, notifier_builder) @notifiers = Array(channel_ids).map do |channel_id| notifier_builder.call(channel_id) end end |
Instance Attribute Details
#notifiers ⇒ Object (readonly)
Returns the value of attribute notifiers.
3 4 5 |
# File 'lib/websocket_messaging/multicast_notifier.rb', line 3 def notifiers @notifiers end |
Instance Method Details
#notify(message) ⇒ Object
11 12 13 |
# File 'lib/websocket_messaging/multicast_notifier.rb', line 11 def notify() @notifiers.each { |n| n.notify() } end |