Class: Celluloid::Internals::Receiver
- Inherits:
-
Object
- Object
- Celluloid::Internals::Receiver
- Defined in:
- lib/celluloid/internals/receivers.rb
Overview
Methods blocking on a call to receive
Instance Attribute Summary collapse
-
#timer ⇒ Object
Returns the value of attribute timer.
Instance Method Summary collapse
-
#initialize(block) ⇒ Receiver
constructor
A new instance of Receiver.
-
#match(message) ⇒ Object
Match a message with this receiver’s block.
- #resume(message = nil) ⇒ Object
Constructor Details
#initialize(block) ⇒ Receiver
Returns a new instance of Receiver.
48 49 50 51 52 |
# File 'lib/celluloid/internals/receivers.rb', line 48 def initialize(block) @block = block @task = Task.current @timer = nil end |
Instance Attribute Details
#timer ⇒ Object
Returns the value of attribute timer.
46 47 48 |
# File 'lib/celluloid/internals/receivers.rb', line 46 def timer @timer end |
Instance Method Details
#match(message) ⇒ Object
Match a message with this receiver’s block
55 56 57 |
# File 'lib/celluloid/internals/receivers.rb', line 55 def match() @block ? @block.call() : true end |
#resume(message = nil) ⇒ Object
59 60 61 |
# File 'lib/celluloid/internals/receivers.rb', line 59 def resume( = nil) @task.resume end |