Sha256: 4d017131629b59f5305fc0fa0e819094407bde59e24f343c66b93627bb736029

Contents?: true

Size: 1.06 KB

Versions: 8

Compression:

Stored size: 1.06 KB

Contents

module Concurrent
  module Actor
    class Envelope
      include TypeCheck

      # @!attribute [r] message
      #   @return [Object] a message
      # @!attribute [r] future
      #   @return [Edge::Future] a future which becomes resolved after message is processed
      # @!attribute [r] sender
      #   @return [Reference, Thread] an actor or thread sending the message
      # @!attribute [r] address
      #   @return [Reference] where this message will be delivered

      attr_reader :message, :future, :sender, :address

      def initialize(message, future, sender, address)
        @message = message
        @future  = Type! future, Promises::ResolvableFuture, NilClass
        @sender  = Type! sender, Reference, Thread
        @address = Type! address, Reference
      end

      def sender_path
        if sender.is_a? Reference
          sender.path
        else
          sender.to_s
        end
      end

      def address_path
        address.path
      end

      def reject!(error)
        future.reject error unless future.nil?
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
concurrent-ruby-edge-0.6.0 lib/concurrent-ruby-edge/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.6.0.pre1 lib/concurrent-ruby-edge/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.5.0 lib-edge/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.4.1 lib-edge/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.4.0.pre2 lib-edge/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.4.0.pre1 lib-edge/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.3.1 lib/concurrent/actor/envelope.rb
concurrent-ruby-edge-0.3.0 lib/concurrent/actor/envelope.rb