Class: Celluloid::Internals::Receiver

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



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

#timerObject

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(message)
  @block ? @block.call(message) : true
end

#resume(message = nil) ⇒ Object



59
60
61
# File 'lib/celluloid/internals/receivers.rb', line 59

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