chriskite/jimson — Issue #6: [Improvement] Support to modules
Author: josevalim
Created: 2012-03-07 11:40:50+00:00
State: open

Today, I cannot use a module as a handler:

module MyModule
extend Jimson::Handler
def sum(a, b)
a + b
end
end

server = Jimson::Server.new(MyHandler)

The reason this fails is because the server expects the class of the object given to respond to a jimson method:

https://github.com/chriskite/jimson/blob/next/lib/jimson/server.rb#L168

A possible approach to this problem is to move this method to the instance, probably something along the lines of `jimson_respond_to?`. We could use the extended hook to inject this method in the instance.

If agreed, I can work on a pull request. :)