# Class: Concurrent::Actor::Envelope

Inherits:
  Object
  - Object
  - Concurrent::Actor::Envelope
  show all

Includes:
  TypeCheck

Defined in:
  lib-edge/concurrent/actor/envelope.rb

## Instance Attribute Summary collapse

- #address ⇒ undocumented readonly
- #future ⇒ Edge::Future readonly

  A future which becomes resolved after message is processed.

- #message ⇒ Object readonly

  A message.

- #sender ⇒ Reference, Thread readonly

  An actor or thread sending the message.

## Instance Method Summary collapse

- #address_path ⇒ undocumented
- #initialize(message, future, sender, address) ⇒ Envelope constructor

  A new instance of Envelope.

- #reject!(error) ⇒ undocumented
- #sender_path ⇒ undocumented
- #Child!(value, *types) ⇒ undocumented included from TypeCheck
- #Child?(value, *types) ⇒ Boolean included from TypeCheck
- #Match!(value, *types) ⇒ undocumented included from TypeCheck
- #Match?(value, *types) ⇒ Boolean included from TypeCheck
- #Type!(value, *types) ⇒ undocumented included from TypeCheck
- #Type?(value, *types) ⇒ Boolean included from TypeCheck

## Constructor Details

### #initialize(message, future, sender, address) ⇒ `Envelope`

Returns a new instance of Envelope

    17
    18
    19
    20
    21
    22

    # File 'lib-edge/concurrent/actor/envelope.rb', line 17

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

## Instance Attribute Details

### #address ⇒ `undocumented` (readonly)

    15

    # File 'lib-edge/concurrent/actor/envelope.rb', line 15

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

### #future ⇒ `Edge::Future` (readonly)

Returns a future which becomes resolved after message is processed

Returns:

- (`Edge::Future`) —

  a future which becomes resolved after message is processed

    15

    # File 'lib-edge/concurrent/actor/envelope.rb', line 15

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

### #message ⇒ `Object` (readonly)

Returns a message

Returns:

- (`Object`) —

  a message

    15
    16
    17

    # File 'lib-edge/concurrent/actor/envelope.rb', line 15

    def message
      @message
    end

### #sender ⇒ `Reference`, `Thread` (readonly)

Returns an actor or thread sending the message

Returns:

- (`Reference`, `Thread`) —

  an actor or thread sending the message

    15

    # File 'lib-edge/concurrent/actor/envelope.rb', line 15

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

## Instance Method Details

### #address_path ⇒ `undocumented`

    32
    33
    34

    # File 'lib-edge/concurrent/actor/envelope.rb', line 32

    def address_path
      address.path
    end

### #reject!(error) ⇒ `undocumented`

    36
    37
    38

    # File 'lib-edge/concurrent/actor/envelope.rb', line 36

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

### #sender_path ⇒ `undocumented`

    24
    25
    26
    27
    28
    29
    30

    # File 'lib-edge/concurrent/actor/envelope.rb', line 24

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

### #Child!(value, *types) ⇒ `undocumented` Originally defined in module TypeCheck

### #Child?(value, *types) ⇒ `Boolean` Originally defined in module TypeCheck

Returns:

- (`Boolean`)

### #Match!(value, *types) ⇒ `undocumented` Originally defined in module TypeCheck

### #Match?(value, *types) ⇒ `Boolean` Originally defined in module TypeCheck

Returns:

- (`Boolean`)

### #Type!(value, *types) ⇒ `undocumented` Originally defined in module TypeCheck

### #Type?(value, *types) ⇒ `Boolean` Originally defined in module TypeCheck

Returns:

- (`Boolean`)