Class: Async::ResultNotification
- Inherits:
-
Object
- Object
- Async::ResultNotification
- Defined in:
- lib/async/result_notification.rb
Instance Method Summary collapse
-
#initialize ⇒ ResultNotification
constructor
A new instance of ResultNotification.
- #signal(item = nil) ⇒ Object
- #wait ⇒ Object
Constructor Details
#initialize ⇒ ResultNotification
Returns a new instance of ResultNotification.
4 5 6 |
# File 'lib/async/result_notification.rb', line 4 def initialize @channel = Async::Channel.new end |
Instance Method Details
#signal(item = nil) ⇒ Object
8 9 10 11 12 |
# File 'lib/async/result_notification.rb', line 8 def signal(item = nil) @channel << (block_given? ? yield : item) rescue Async::Stop, StandardError => e @channel.error(e) end |
#wait ⇒ Object
14 |
# File 'lib/async/result_notification.rb', line 14 def wait = @channel.dequeue |