{"action":"created","issue":{"url":"https://api.github.com/repos/dry-rb/dry-auto_inject/issues/15","repository_url":"https://api.github.com/repos/dry-rb/dry-auto_inject","labels_url":"https://api.github.com/repos/dry-rb/dry-auto_inject/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/dry-rb/dry-auto_inject/issues/15/comments","events_url":"https://api.github.com/repos/dry-rb/dry-auto_inject/issues/15/events","html_url":"https://github.com/dry-rb/dry-auto_inject/issues/15","id":156119200,"number":15,"title":"Wrong Number of Arguments When Resolving from Container","user":{"login":"wjdhamilton","id":7499818,"avatar_url":"https://avatars.githubusercontent.com/u/7499818?v=3","gravatar_id":"","url":"https://api.github.com/users/wjdhamilton","html_url":"https://github.com/wjdhamilton","followers_url":"https://api.github.com/users/wjdhamilton/followers","following_url":"https://api.github.com/users/wjdhamilton/following{/other_user}","gists_url":"https://api.github.com/users/wjdhamilton/gists{/gist_id}","starred_url":"https://api.github.com/users/wjdhamilton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjdhamilton/subscriptions","organizations_url":"https://api.github.com/users/wjdhamilton/orgs","repos_url":"https://api.github.com/users/wjdhamilton/repos","events_url":"https://api.github.com/users/wjdhamilton/events{/privacy}","received_events_url":"https://api.github.com/users/wjdhamilton/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-21T20:04:56Z","updated_at":"2016-05-22T07:11:57Z","closed_at":"2016-05-22T07:11:57Z","body":"Guys,\r\n\r\nThis is probably a rookie error, but I am trying to implement `dry-container` with `dry-autoinject` as per http://icelab.com.au/articles/better-code-with-an-inversion-of-control-container/.\r\n\r\nHere's my container: \r\n\r\n```ruby\r\nrequire \"dry-container\"\r\nrequire \"dry-auto_inject\"\r\nrequire \"easy_json_matcher/node\"\r\nrequire \"easy_json_matcher/array_generator\"\r\nrequire \"easy_json_matcher/attribute_generator\"\r\nrequire \"easy_json_matcher/schema_library\"\r\n\r\n\r\nmodule EasyJSONMatcher\r\n  class Container\r\n    extend Dry::Container::Mixin\r\n  end\r\n\r\n  Container.register \"node\", -> { Node }\r\n  Container.register \"array_generator\", -> { ArrayGenerator }\r\n  Container.register \"attribute_generator\", -> { AttributeGenerator }\r\n  Container.register \"schema_library\", -> { SchemaLibrary }\r\n\r\n  AutoInject = Dry::AutoInject(Container)\r\nend\r\n```\r\n\r\nand here's the injection: \r\n\r\n```ruby\r\nmodule EasyJSONMatcher\r\n  class NodeGenerator\r\n    include AutoInject[\"node\", \"attribute_generator\", \"array_generator\", \"schema_library\"]\r\n    include AttributeTypeMethods\r\n```\r\n\r\n...which looks right to me (naturally), however when I try to create an instance of the `NodeGenerator` class by calling `#new` I get the following error:\r\n\r\n`ArgumentError: wrong number of arguments (given 4, expected 0)`\r\n\r\n...don't really know where to start with this. Any input would be appreciated!"},"comment":{"url":"https://api.github.com/repos/dry-rb/dry-auto_inject/issues/comments/220818008","html_url":"https://github.com/dry-rb/dry-auto_inject/issues/15#issuecomment-220818008","issue_url":"https://api.github.com/repos/dry-rb/dry-auto_inject/issues/15","id":220818008,"user":{"login":"wjdhamilton","id":7499818,"avatar_url":"https://avatars.githubusercontent.com/u/7499818?v=3","gravatar_id":"","url":"https://api.github.com/users/wjdhamilton","html_url":"https://github.com/wjdhamilton","followers_url":"https://api.github.com/users/wjdhamilton/followers","following_url":"https://api.github.com/users/wjdhamilton/following{/other_user}","gists_url":"https://api.github.com/users/wjdhamilton/gists{/gist_id}","starred_url":"https://api.github.com/users/wjdhamilton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjdhamilton/subscriptions","organizations_url":"https://api.github.com/users/wjdhamilton/orgs","repos_url":"https://api.github.com/users/wjdhamilton/repos","events_url":"https://api.github.com/users/wjdhamilton/events{/privacy}","received_events_url":"https://api.github.com/users/wjdhamilton/received_events","type":"User","site_admin":false},"created_at":"2016-05-22T07:11:57Z","updated_at":"2016-05-22T07:11:57Z","body":"@flash-gordon Thank you very much. Fixed it! There was two things I had to work through: one was that I'm using keyword args and so I had to adapt the call to `AutoInject` to this, as per the tests: \r\n\r\n```ruby\r\ninclude AutoInject.kwargs[...]\r\n```\r\n\r\nand the constructor had to be changed as follows:\r\n\r\n```ruby\r\ndef initialize(opts: [], global_opts: [], **args)\r\n```\r\n\r\n...and then also pull the master branch since the ruby gems version threw a`NoMethodError` for kwargs. \r\n\r\nNow just to investigate how all this magic happens and I'll be able to move along... "}}
{"actor":{"display_login":"wjdhamilton"}}