Sha256: 31e05a99de6171404ff9e43cd72c2ccb0fc9a3f7e458fe967c09a0907f3a6b1d
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
module Marvin class MiddleMan is :loggable, :dispatchable attr_reader :client class << self def setup? @@setup ||= false end def setup! Marvin::Settings.client.register_handler self.new @@setup = true end # Setup iff setup hasn't been done. def setup setup! unless setup? end end # When we're told to set the client, not only do we set out own instance # but we also echo the command down to all of our sub-clients. def client=(new_client) @client = new_client setup_subhandler_clients end def process_event(message, options) return message, options end # Filter incoming events. def handle(message, options) message, options = process_event(message, options) dispatch(message, options) end private def setup_subhandler_clients current_client = self.client handlers.each { |sh| sh.client = current_client if sh.respond_to?(:client=) } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
marvin-0.8.2 | lib/marvin/middle_man.rb |