Class: Bolt::Notifier
- Inherits:
-
Object
- Object
- Bolt::Notifier
- Defined in:
- lib/bolt/notifier.rb
Instance Method Summary collapse
-
#initialize(executor = Concurrent::SingleThreadExecutor.new) ⇒ Notifier
constructor
A new instance of Notifier.
- #notify(callback, event) ⇒ Object
- #shutdown ⇒ Object
Constructor Details
#initialize(executor = Concurrent::SingleThreadExecutor.new) ⇒ Notifier
Returns a new instance of Notifier.
7 8 9 |
# File 'lib/bolt/notifier.rb', line 7 def initialize(executor = Concurrent::SingleThreadExecutor.new) @executor = executor end |
Instance Method Details
#notify(callback, event) ⇒ Object
11 12 13 14 15 |
# File 'lib/bolt/notifier.rb', line 11 def notify(callback, event) @executor.post do callback.call(event) end end |
#shutdown ⇒ Object
17 18 19 20 |
# File 'lib/bolt/notifier.rb', line 17 def shutdown @executor.shutdown @executor.wait_for_termination end |