class Celluloid::Internals::Handlers
Public Class Methods
new()
click to toggle source
# File lib/celluloid/internals/handlers.rb, line 6 def initialize @handlers = Set.new end
Public Instance Methods
handle(*patterns, &block)
click to toggle source
# File lib/celluloid/internals/handlers.rb, line 10 def handle(*patterns, &block) patterns.each do |pattern| handler = Handler.new pattern, block @handlers << handler end end
handle_message(message)
click to toggle source
Handle incoming messages
# File lib/celluloid/internals/handlers.rb, line 18 def handle_message(message) handler = @handlers.find { |h| h.match(message) } handler.call message if handler handler end