Class: Celluloid::Receiver

Inherits:
Object show all
Defined in:
lib/vendor/celluloid/lib/celluloid/receivers.rb

Overview

Methods blocking on a call to receive

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ Receiver

Returns a new instance of Receiver.



51
52
53
54
55
# File 'lib/vendor/celluloid/lib/celluloid/receivers.rb', line 51

def initialize(block)
  @block = block
  @task  = Task.current
  @timer = nil
end

Instance Attribute Details

#timerObject

Returns the value of attribute timer.



49
50
51
# File 'lib/vendor/celluloid/lib/celluloid/receivers.rb', line 49

def timer
  @timer
end

Instance Method Details

#match(message) ⇒ Object

Match a message with this receiver’s block



58
59
60
# File 'lib/vendor/celluloid/lib/celluloid/receivers.rb', line 58

def match(message)
  @block.call(message) if @block
end

#resume(message = nil) ⇒ Object



62
63
64
# File 'lib/vendor/celluloid/lib/celluloid/receivers.rb', line 62

def resume(message = nil)
  @task.resume message
end