Class: Celluloid::Receiver

Inherits:
Object
  • Object
show all
Defined in:
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.



55
56
57
58
59
# File 'lib/celluloid/receivers.rb', line 55

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

Instance Attribute Details

#timerObject

Returns the value of attribute timer.



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

def timer
  @timer
end

Instance Method Details

#match(message) ⇒ Object

Match a message with this receiver’s block



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

def match(message)
  @block ? @block.call(message) : true
end

#resume(message = nil) ⇒ Object



66
67
68
# File 'lib/celluloid/receivers.rb', line 66

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