Sha256: d8b5fdde6c3048d2cadc5c56a6c2df4258d972f009686f25dca4947046afe533

Contents?: true

Size: 296 Bytes

Versions: 17

Compression:

Stored size: 296 Bytes

Contents

# frozen_string_literal: true

class Async::ResultNotification
  def initialize
    @channel = Async::Channel.new
  end

  def signal(item = nil)
    @channel << (block_given? ? yield : item)
  rescue Async::Stop, StandardError => e
    @channel.error(e)
  end

  def wait = @channel.dequeue
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
async-tools-0.2.10 lib/async/result_notification.rb
async-tools-0.2.9 lib/async/result_notification.rb
async-tools-0.2.8 lib/async/result_notification.rb
async-tools-0.2.7 lib/async/result_notification.rb
async-tools-0.2.6 lib/async/result_notification.rb
async-tools-0.2.5 lib/async/result_notification.rb
async-tools-0.2.4 lib/async/result_notification.rb
async-tools-0.2.2 lib/async/result_notification.rb
async-tools-0.2.1 lib/async/result_notification.rb
async-tools-0.1.10 lib/async/result_notification.rb
async-tools-0.1.9 lib/async/result_notification.rb
async-tools-0.1.8 lib/async/result_notification.rb
async-tools-0.1.7 lib/async/result_notification.rb
async-tools-0.1.6 lib/async/result_notification.rb
async-tools-0.1.5 lib/async/result_notification.rb
async-tools-0.1.4 lib/async/result_notification.rb
async-tools-0.1.3 lib/async/result_notification.rb