Class List Method List File List

# Class: Concurrent::Actor::Envelope

Inherits:
  Object
  - Object
  - Concurrent::Actor::Envelope
  show all
Includes:
  TypeCheck
Defined in:
  lib/concurrent/actor/envelope.rb

## Instance Attribute Summary (collapse)

- - (undocumented) address readonly
- - (Edge::Future) future readonly

  A future which becomes resolved after message is processed.

- - (Object) message readonly

  A message.

- - (Reference, Thread) sender readonly

  An actor or thread sending the message.

## Instance Method Summary (collapse)

- - (undocumented) address_path
- - (undocumented) Child!(value, *types) included from TypeCheck
- - (Boolean) Child?(value, *types) included from TypeCheck
- - (Envelope) initialize(message, future, sender, address) constructor

  A new instance of Envelope.

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

## Constructor Details

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

Returns a new instance of Envelope

    17
    18
    19
    20
    21
    22

    # File 'lib/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

### - (`undocumented`) address (readonly)

    15

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

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

### - (`Edge::Future`) 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/concurrent/actor/envelope.rb', line 15

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

### - (`Object`) message (readonly)

Returns a message

Returns:

- (`Object`) —

  a message

    15
    16
    17

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

    def message
      @message
    end

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

Returns an actor or thread sending the message

Returns:

- (`Reference`, `Thread`) —

  an actor or thread sending the message

    15

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

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

## Instance Method Details

### - (`undocumented`) address_path

    32
    33
    34

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

    def address_path
      address.path
    end

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

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

Returns:

- (`Boolean`)

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

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

Returns:

- (`Boolean`)

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

    36
    37
    38

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

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

### - (`undocumented`) sender_path

    24
    25
    26
    27
    28
    29
    30

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

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

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

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

Returns:

- (`Boolean`)