Sha256: a01369e8c632217ba04f360f78d660b4fbb90486fc2506ef060d8217f0dda2d6
Contents?: true
Size: 705 Bytes
Versions: 3
Compression:
Stored size: 705 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['::'] require(class_name.underscore) # Get the class klass = Object.send(:const_get, class_name) # 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
volt-0.4.0 | lib/volt/tasks/dispatcher.rb |
volt-0.3.9 | lib/volt/tasks/dispatcher.rb |
volt-0.3.8 | lib/volt/tasks/dispatcher.rb |