Class: Concurrent::Actress::Envelope

Inherits:
Struct
  • Object
show all
Includes:
TypeCheck
Defined in:
lib/concurrent/actress/envelope.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TypeCheck

#Child!, #Child?, #Match!, #Match?, #Type!, #Type?

Constructor Details

#initialize(message, ivar, sender) ⇒ Envelope

Returns a new instance of Envelope.



6
7
8
9
10
# File 'lib/concurrent/actress/envelope.rb', line 6

def initialize(message, ivar, sender)
  super message,
        (Type! ivar, IVar, NilClass),
        (Type! sender, Reference, Thread)
end

Instance Attribute Details

#ivarObject

Returns the value of attribute ivar

Returns:

  • (Object)

    the current value of ivar



3
4
5
# File 'lib/concurrent/actress/envelope.rb', line 3

def ivar
  @ivar
end

#messageObject

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



3
4
5
# File 'lib/concurrent/actress/envelope.rb', line 3

def message
  @message
end

#senderObject

Returns the value of attribute sender

Returns:

  • (Object)

    the current value of sender



3
4
5
# File 'lib/concurrent/actress/envelope.rb', line 3

def sender
  @sender
end

Instance Method Details

#reject!(error) ⇒ Object



20
21
22
# File 'lib/concurrent/actress/envelope.rb', line 20

def reject!(error)
  ivar.fail error unless ivar.nil?
end

#sender_pathObject



12
13
14
15
16
17
18
# File 'lib/concurrent/actress/envelope.rb', line 12

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