Class: Celluloid::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/celluloid/handlers.rb

Overview

Methods blocking on a call to receive

Instance Method Summary collapse

Constructor Details

#initialize(pattern, block) ⇒ Handler

Returns a new instance of Handler.


26
27
28
29
# File 'lib/celluloid/handlers.rb', line 26

def initialize(pattern, block)
  @pattern = pattern
  @block = block
end

Instance Method Details

#call(message) ⇒ Object


36
37
38
# File 'lib/celluloid/handlers.rb', line 36

def call(message)
  @block.call message
end

#match(message) ⇒ Object

Match a message with this receiver's block


32
33
34
# File 'lib/celluloid/handlers.rb', line 32

def match(message)
  @pattern === message
end