Class: Async::ResultNotification

Inherits:
Object
  • Object
show all
Defined in:
lib/async/result_notification.rb

Instance Method Summary collapse

Constructor Details

#initializeResultNotification

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

#waitObject



14
# File 'lib/async/result_notification.rb', line 14

def wait = @channel.dequeue