Sha256: a73904ddc4c5d850833d27493a0b3257725f31245028b747e841500d4672266c

Contents?: true

Size: 331 Bytes

Versions: 3

Compression:

Stored size: 331 Bytes

Contents

# frozen_string_literal: true

class Async::ResultNotification
  extend Forwardable

  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_delegator :@channel, :dequeue, :wait
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
async-tools-0.1.2 lib/async/result_notification.rb
async-tools-0.1.1 lib/async/result_notification.rb
async-tools-0.1.0 lib/async/result_notification.rb