Class: Celluloid::Internals::Handler

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


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

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

Instance Method Details

#call(message) ⇒ Object


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

def call(message)
  @block.call message
end

#match(message) ⇒ Object

Match a message with this receiver's block


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

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