Module: Mongo::Event::Publisher
- Included in:
- Server::Description::Inspector::DescriptionChanged, Server::Description::Inspector::MemberDiscovered, Server::Description::Inspector::PrimaryElected, Server::Description::Inspector::StandaloneDiscovered
- Defined in:
- lib/mongo/event/publisher.rb
Overview
This module is included for objects that need to publish events.
Instance Attribute Summary collapse
-
#event_listeners ⇒ Event::Listeners
readonly
Event_listeners The listeners.
Instance Method Summary collapse
-
#publish(event, *args) ⇒ Object
Publish the provided event.
Instance Attribute Details
#event_listeners ⇒ Event::Listeners (readonly)
Returns event_listeners The listeners.
24 25 26 |
# File 'lib/mongo/event/publisher.rb', line 24 def event_listeners @event_listeners end |
Instance Method Details
#publish(event, *args) ⇒ Object
Publish the provided event.
35 36 37 38 39 |
# File 'lib/mongo/event/publisher.rb', line 35 def publish(event, *args) event_listeners.listeners_for(event).each do |listener| listener.handle(*args) end end |