[Improvement] Support for modules as handlers
josevalim opened this issue · 1 comments
josevalim commented
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. :)
chriskite commented
That sounds good, I'd love to see your pull request :)