{"action":"opened","number":18,"pull_request":{"url":"https://api.github.com/repos/dry-rb/dry-initializer/pulls/18","id":98250583,"html_url":"https://github.com/dry-rb/dry-initializer/pull/18","diff_url":"https://github.com/dry-rb/dry-initializer/pull/18.diff","patch_url":"https://github.com/dry-rb/dry-initializer/pull/18.patch","issue_url":"https://api.github.com/repos/dry-rb/dry-initializer/issues/18","number":18,"state":"open","locked":false,"title":"Cannot use an Hash as the last parameter when there are no options and the last param has a default","user":{"login":"nolith","id":78752,"avatar_url":"https://avatars.githubusercontent.com/u/78752?v=3","gravatar_id":"","url":"https://api.github.com/users/nolith","html_url":"https://github.com/nolith","followers_url":"https://api.github.com/users/nolith/followers","following_url":"https://api.github.com/users/nolith/following{/other_user}","gists_url":"https://api.github.com/users/nolith/gists{/gist_id}","starred_url":"https://api.github.com/users/nolith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nolith/subscriptions","organizations_url":"https://api.github.com/users/nolith/orgs","repos_url":"https://api.github.com/users/nolith/repos","events_url":"https://api.github.com/users/nolith/events{/privacy}","received_events_url":"https://api.github.com/users/nolith/received_events","type":"User","site_admin":false},"body":"Hello, I've found an edge case in ``Dry::Initializer::Signature#call``\r\n\r\nI was attempting to migrate an existing class to dry-initializer\r\nThat class used to have an optional field defaulted to `{}`\r\n\r\n```ruby\r\nclass Test::Bar\r\n  attr_accessor :foo, :bar\r\n\r\n  def initialize(foo, bar = {})\r\n    @foo = foo\r\n    @bar = bar\r\n  end\r\nend\r\n```\r\n\r\nReading the documentation I refactored the class this way\r\n\r\n```ruby\r\nclass Test::Bar\r\n  include Dry::Initializer.define -> do\r\n    param  :foo\r\n    param  :bar, default: proc { {} }\r\n  end\r\nend\r\n```\r\n\r\nBut all my test failted due to this strange behaviour\r\n\r\n```ruby\r\na = Test::Bar.new(1, { test: true })\r\na.foo #=> 1\r\na.bar #=> {}\r\n```\r\n\r\nThis patch will provide a default value for the ``__options__`` constructor argument in case of missing option in the initializer definition.\r\n\r\n\r\n\r\n","created_at":"2016-12-15T23:17:26Z","updated_at":"2016-12-15T23:17:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/dry-rb/dry-initializer/pulls/18/commits","review_comments_url":"https://api.github.com/repos/dry-rb/dry-initializer/pulls/18/comments","review_comment_url":"https://api.github.com/repos/dry-rb/dry-initializer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dry-rb/dry-initializer/issues/18/comments","statuses_url":"https://api.github.com/repos/dry-rb/dry-initializer/statuses/edde76fa4600f2b856a6de95907de858dca70a5f","head":{"label":"nolith:fix_signature","ref":"fix_signature","sha":"edde76fa4600f2b856a6de95907de858dca70a5f","user":{"login":"nolith","id":78752,"avatar_url":"https://avatars.githubusercontent.com/u/78752?v=3","gravatar_id":"","url":"https://api.github.com/users/nolith","html_url":"https://github.com/nolith","followers_url":"https://api.github.com/users/nolith/followers","following_url":"https://api.github.com/users/nolith/following{/other_user}","gists_url":"https://api.github.com/users/nolith/gists{/gist_id}","starred_url":"https://api.github.com/users/nolith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nolith/subscriptions","organizations_url":"https://api.github.com/users/nolith/orgs","repos_url":"https://api.github.com/users/nolith/repos","events_url":"https://api.github.com/users/nolith/events{/privacy}","received_events_url":"https://api.github.com/users/nolith/received_events","type":"User","site_admin":false},"repo":{"id":76586328,"name":"dry-initializer","full_name":"nolith/dry-initializer","owner":{"login":"nolith","id":78752,"avatar_url":"https://avatars.githubusercontent.com/u/78752?v=3","gravatar_id":"","url":"https://api.github.com/users/nolith","html_url":"https://github.com/nolith","followers_url":"https://api.github.com/users/nolith/followers","following_url":"https://api.github.com/users/nolith/following{/other_user}","gists_url":"https://api.github.com/users/nolith/gists{/gist_id}","starred_url":"https://api.github.com/users/nolith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nolith/subscriptions","organizations_url":"https://api.github.com/users/nolith/orgs","repos_url":"https://api.github.com/users/nolith/repos","events_url":"https://api.github.com/users/nolith/events{/privacy}","received_events_url":"https://api.github.com/users/nolith/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nolith/dry-initializer","description":"DSL for building class initializer with params and options.","fork":true,"url":"https://api.github.com/repos/nolith/dry-initializer","forks_url":"https://api.github.com/repos/nolith/dry-initializer/forks","keys_url":"https://api.github.com/repos/nolith/dry-initializer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nolith/dry-initializer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nolith/dry-initializer/teams","hooks_url":"https://api.github.com/repos/nolith/dry-initializer/hooks","issue_events_url":"https://api.github.com/repos/nolith/dry-initializer/issues/events{/number}","events_url":"https://api.github.com/repos/nolith/dry-initializer/events","assignees_url":"https://api.github.com/repos/nolith/dry-initializer/assignees{/user}","branches_url":"https://api.github.com/repos/nolith/dry-initializer/branches{/branch}","tags_url":"https://api.github.com/repos/nolith/dry-initializer/tags","blobs_url":"https://api.github.com/repos/nolith/dry-initializer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nolith/dry-initializer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nolith/dry-initializer/git/refs{/sha}","trees_url":"https://api.github.com/repos/nolith/dry-initializer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nolith/dry-initializer/statuses/{sha}","languages_url":"https://api.github.com/repos/nolith/dry-initializer/languages","stargazers_url":"https://api.github.com/repos/nolith/dry-initializer/stargazers","contributors_url":"https://api.github.com/repos/nolith/dry-initializer/contributors","subscribers_url":"https://api.github.com/repos/nolith/dry-initializer/subscribers","subscription_url":"https://api.github.com/repos/nolith/dry-initializer/subscription","commits_url":"https://api.github.com/repos/nolith/dry-initializer/commits{/sha}","git_commits_url":"https://api.github.com/repos/nolith/dry-initializer/git/commits{/sha}","comments_url":"https://api.github.com/repos/nolith/dry-initializer/comments{/number}","issue_comment_url":"https://api.github.com/repos/nolith/dry-initializer/issues/comments{/number}","contents_url":"https://api.github.com/repos/nolith/dry-initializer/contents/{+path}","compare_url":"https://api.github.com/repos/nolith/dry-initializer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nolith/dry-initializer/merges","archive_url":"https://api.github.com/repos/nolith/dry-initializer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nolith/dry-initializer/downloads","issues_url":"https://api.github.com/repos/nolith/dry-initializer/issues{/number}","pulls_url":"https://api.github.com/repos/nolith/dry-initializer/pulls{/number}","milestones_url":"https://api.github.com/repos/nolith/dry-initializer/milestones{/number}","notifications_url":"https://api.github.com/repos/nolith/dry-initializer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nolith/dry-initializer/labels{/name}","releases_url":"https://api.github.com/repos/nolith/dry-initializer/releases{/id}","deployments_url":"https://api.github.com/repos/nolith/dry-initializer/deployments","created_at":"2016-12-15T18:45:57Z","updated_at":"2016-12-15T18:45:59Z","pushed_at":"2016-12-15T23:04:10Z","git_url":"git://github.com/nolith/dry-initializer.git","ssh_url":"git@github.com:nolith/dry-initializer.git","clone_url":"https://github.com/nolith/dry-initializer.git","svn_url":"https://github.com/nolith/dry-initializer","homepage":"http://dry-rb.org/gems/dry-initializer","size":104,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dry-rb:master","ref":"master","sha":"a0b788401cd4dd0b0955c3e51dd16b1c6928bc24","user":{"login":"dry-rb","id":11280820,"avatar_url":"https://avatars.githubusercontent.com/u/11280820?v=3","gravatar_id":"","url":"https://api.github.com/users/dry-rb","html_url":"https://github.com/dry-rb","followers_url":"https://api.github.com/users/dry-rb/followers","following_url":"https://api.github.com/users/dry-rb/following{/other_user}","gists_url":"https://api.github.com/users/dry-rb/gists{/gist_id}","starred_url":"https://api.github.com/users/dry-rb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dry-rb/subscriptions","organizations_url":"https://api.github.com/users/dry-rb/orgs","repos_url":"https://api.github.com/users/dry-rb/repos","events_url":"https://api.github.com/users/dry-rb/events{/privacy}","received_events_url":"https://api.github.com/users/dry-rb/received_events","type":"Organization","site_admin":false},"repo":{"id":52085287,"name":"dry-initializer","full_name":"dry-rb/dry-initializer","owner":{"login":"dry-rb","id":11280820,"avatar_url":"https://avatars.githubusercontent.com/u/11280820?v=3","gravatar_id":"","url":"https://api.github.com/users/dry-rb","html_url":"https://github.com/dry-rb","followers_url":"https://api.github.com/users/dry-rb/followers","following_url":"https://api.github.com/users/dry-rb/following{/other_user}","gists_url":"https://api.github.com/users/dry-rb/gists{/gist_id}","starred_url":"https://api.github.com/users/dry-rb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dry-rb/subscriptions","organizations_url":"https://api.github.com/users/dry-rb/orgs","repos_url":"https://api.github.com/users/dry-rb/repos","events_url":"https://api.github.com/users/dry-rb/events{/privacy}","received_events_url":"https://api.github.com/users/dry-rb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/dry-rb/dry-initializer","description":"DSL for building class initializer with params and options.","fork":false,"url":"https://api.github.com/repos/dry-rb/dry-initializer","forks_url":"https://api.github.com/repos/dry-rb/dry-initializer/forks","keys_url":"https://api.github.com/repos/dry-rb/dry-initializer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dry-rb/dry-initializer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dry-rb/dry-initializer/teams","hooks_url":"https://api.github.com/repos/dry-rb/dry-initializer/hooks","issue_events_url":"https://api.github.com/repos/dry-rb/dry-initializer/issues/events{/number}","events_url":"https://api.github.com/repos/dry-rb/dry-initializer/events","assignees_url":"https://api.github.com/repos/dry-rb/dry-initializer/assignees{/user}","branches_url":"https://api.github.com/repos/dry-rb/dry-initializer/branches{/branch}","tags_url":"https://api.github.com/repos/dry-rb/dry-initializer/tags","blobs_url":"https://api.github.com/repos/dry-rb/dry-initializer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dry-rb/dry-initializer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dry-rb/dry-initializer/git/refs{/sha}","trees_url":"https://api.github.com/repos/dry-rb/dry-initializer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dry-rb/dry-initializer/statuses/{sha}","languages_url":"https://api.github.com/repos/dry-rb/dry-initializer/languages","stargazers_url":"https://api.github.com/repos/dry-rb/dry-initializer/stargazers","contributors_url":"https://api.github.com/repos/dry-rb/dry-initializer/contributors","subscribers_url":"https://api.github.com/repos/dry-rb/dry-initializer/subscribers","subscription_url":"https://api.github.com/repos/dry-rb/dry-initializer/subscription","commits_url":"https://api.github.com/repos/dry-rb/dry-initializer/commits{/sha}","git_commits_url":"https://api.github.com/repos/dry-rb/dry-initializer/git/commits{/sha}","comments_url":"https://api.github.com/repos/dry-rb/dry-initializer/comments{/number}","issue_comment_url":"https://api.github.com/repos/dry-rb/dry-initializer/issues/comments{/number}","contents_url":"https://api.github.com/repos/dry-rb/dry-initializer/contents/{+path}","compare_url":"https://api.github.com/repos/dry-rb/dry-initializer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dry-rb/dry-initializer/merges","archive_url":"https://api.github.com/repos/dry-rb/dry-initializer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dry-rb/dry-initializer/downloads","issues_url":"https://api.github.com/repos/dry-rb/dry-initializer/issues{/number}","pulls_url":"https://api.github.com/repos/dry-rb/dry-initializer/pulls{/number}","milestones_url":"https://api.github.com/repos/dry-rb/dry-initializer/milestones{/number}","notifications_url":"https://api.github.com/repos/dry-rb/dry-initializer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dry-rb/dry-initializer/labels{/name}","releases_url":"https://api.github.com/repos/dry-rb/dry-initializer/releases{/id}","deployments_url":"https://api.github.com/repos/dry-rb/dry-initializer/deployments","created_at":"2016-02-19T12:08:49Z","updated_at":"2016-11-25T07:41:46Z","pushed_at":"2016-12-15T23:17:26Z","git_url":"git://github.com/dry-rb/dry-initializer.git","ssh_url":"git@github.com:dry-rb/dry-initializer.git","clone_url":"https://github.com/dry-rb/dry-initializer.git","svn_url":"https://github.com/dry-rb/dry-initializer","homepage":"http://dry-rb.org/gems/dry-initializer","size":121,"stargazers_count":24,"watchers_count":24,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":2,"forks":6,"open_issues":2,"watchers":24,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dry-rb/dry-initializer/pulls/18"},"html":{"href":"https://github.com/dry-rb/dry-initializer/pull/18"},"issue":{"href":"https://api.github.com/repos/dry-rb/dry-initializer/issues/18"},"comments":{"href":"https://api.github.com/repos/dry-rb/dry-initializer/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/dry-rb/dry-initializer/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/dry-rb/dry-initializer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dry-rb/dry-initializer/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/dry-rb/dry-initializer/statuses/edde76fa4600f2b856a6de95907de858dca70a5f"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":34,"deletions":1,"changed_files":2}}
{"actor":{"display_login":"nolith"}}