Class: Concurrent::Actor::Envelope

Inherits:
Object
  • Object
show all
Includes:
TypeCheck
Defined in:
lib/concurrent-ruby-edge/concurrent/actor/envelope.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Envelope.



19
20
21
22
23
24
# File 'lib/concurrent-ruby-edge/concurrent/actor/envelope.rb', line 19

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

#addressundocumented (readonly)



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

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

#futureEdge::Future (readonly)

Returns a future which becomes resolved after message is processed.

Returns:

  • (Edge::Future)

    a future which becomes resolved after message is processed



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

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

#messageObject (readonly)

Returns a message.

Returns:

  • (Object)

    a message



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

def message
  @message
end

#senderReference, Thread (readonly)

Returns an actor or thread sending the message.

Returns:

  • (Reference, Thread)

    an actor or thread sending the message



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

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

Instance Method Details

#address_pathundocumented



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

def address_path
  address.path
end

#reject!(error) ⇒ undocumented



38
39
40
# File 'lib/concurrent-ruby-edge/concurrent/actor/envelope.rb', line 38

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

#sender_pathundocumented



26
27
28
29
30
31
32
# File 'lib/concurrent-ruby-edge/concurrent/actor/envelope.rb', line 26

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)