Sha256: f36559fd1867905b093df85bb2622014d961b821b5143bd8ef559395f19c9592
Contents?: true
Size: 788 Bytes
Versions: 6
Compression:
Stored size: 788 Bytes
Contents
# The task dispatcher is responsible for taking incoming messages # from the socket channel and dispatching them to the proper handler. class Dispatcher def dispatch(channel, message) callback_id, class_name, method_name, *args = message # TODO: Think about security? if class_name[/Tasks$/] && !class_name['::'] # TODO: Improve error on a class we don't have require(class_name.underscore) # Get the class klass = Object.send(:const_get, class_name) puts "KLASS: #{klass.inspect}" # Init and send the method result = klass.new(channel, self).send(method_name, *args) if callback_id # Callback with result channel.send_message('response', callback_id, result) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems