Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Improvement] Support for modules as handlers #6

Open
josevalim opened this issue Mar 7, 2012 · 1 comment
Open

[Improvement] Support for modules as handlers #6

josevalim opened this issue Mar 7, 2012 · 1 comment

Comments

@josevalim
Copy link
Contributor

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
Copy link
Collaborator

That sounds good, I'd love to see your pull request :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants