{"action":"created","comment":{"url":"https://api.github.com/repos/zendesk/resque-disable-job/pulls/comments/172162535","pull_request_review_id":101131511,"id":172162535,"diff_hunk":"@@ -93,29 +92,23 @@ def self.remove_specific_rule(rule)\n         # To set the arguments to block we need to keep in mind the parameter order and that\n         # if we don't specify anything, that means we are blocking everything.\n         # The rule is from generic to specific.\n-        def self.args_match(args, set_args)\n-          return true if args == set_args\n-          should_block = args.to_a.map.with_index do |a, i|\n-            # We check each parameter (65) or parameters set ([\"account_id\", 65]) in the job_args with the job_args to be blocked\n-            # if it's nil, then we match, if it's specified, we check for equality (65 == 65 or [\"account_id\", 65] == [\"account_id\", 65])\n-            set_args[i].nil? || a == set_args[i]\n+        def self.args_match(job_args, set_args)\n+          return true if job_args == set_args\n+          # We check each parameter in the job_args with the job_args to be blocked\n+          # if it's nil, then we match, if it's specified, we check for equality (65 == 65)\n+          should_block = if set_args.is_a?(Hash)\n+            # If the set arguments is a hash we try to extract the job arguments as a hash\n+            job_args = job_args.size == 1 && job_args.first.is_a?(Hash) ? job_args.first : job_args\n+            job_args.map { |k, v| set_args[k].nil? || v == set_args[k] }\n+          else\n+            job_args.map.with_index { |a, i| set_args[i].nil? || a == set_args[i] }","path":"lib/resque/plugins/disable_job/job.rb","position":31,"original_position":31,"commit_id":"f9a0c52177b263c5ea0550d0260e30c6669d2dea","original_commit_id":"f9a0c52177b263c5ea0550d0260e30c6669d2dea","user":{"login":"gerardc","id":208511,"avatar_url":"https://avatars1.githubusercontent.com/u/208511?v=4","gravatar_id":"","url":"https://api.github.com/users/gerardc","html_url":"https://github.com/gerardc","followers_url":"https://api.github.com/users/gerardc/followers","following_url":"https://api.github.com/users/gerardc/following{/other_user}","gists_url":"https://api.github.com/users/gerardc/gists{/gist_id}","starred_url":"https://api.github.com/users/gerardc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gerardc/subscriptions","organizations_url":"https://api.github.com/users/gerardc/orgs","repos_url":"https://api.github.com/users/gerardc/repos","events_url":"https://api.github.com/users/gerardc/events{/privacy}","received_events_url":"https://api.github.com/users/gerardc/received_events","type":"User","site_admin":false},"body":"These comments are a smell IMO, can you extract an object to encapsulate all the checking that's going on here?","created_at":"2018-03-05T11:49:12Z","updated_at":"2018-03-05T11:49:12Z","html_url":"https://github.com/zendesk/resque-disable-job/pull/11#discussion_r172162535","pull_request_url":"https://api.github.com/repos/zendesk/resque-disable-job/pulls/11","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/zendesk/resque-disable-job/pulls/comments/172162535"},"html":{"href":"https://github.com/zendesk/resque-disable-job/pull/11#discussion_r172162535"},"pull_request":{"href":"https://api.github.com/repos/zendesk/resque-disable-job/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/zendesk/resque-disable-job/pulls/11","id":172837067,"html_url":"https://github.com/zendesk/resque-disable-job/pull/11","diff_url":"https://github.com/zendesk/resque-disable-job/pull/11.diff","patch_url":"https://github.com/zendesk/resque-disable-job/pull/11.patch","issue_url":"https://api.github.com/repos/zendesk/resque-disable-job/issues/11","number":11,"state":"open","locked":false,"title":"Change the logic to correctly support Hash parameters.","user":{"login":"andreionut","id":1051275,"avatar_url":"https://avatars3.githubusercontent.com/u/1051275?v=4","gravatar_id":"","url":"https://api.github.com/users/andreionut","html_url":"https://github.com/andreionut","followers_url":"https://api.github.com/users/andreionut/followers","following_url":"https://api.github.com/users/andreionut/following{/other_user}","gists_url":"https://api.github.com/users/andreionut/gists{/gist_id}","starred_url":"https://api.github.com/users/andreionut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andreionut/subscriptions","organizations_url":"https://api.github.com/users/andreionut/orgs","repos_url":"https://api.github.com/users/andreionut/repos","events_url":"https://api.github.com/users/andreionut/events{/privacy}","received_events_url":"https://api.github.com/users/andreionut/received_events","type":"User","site_admin":false},"body":"When a user sets a disabled job's parameters as a Hash we try to extract\r\nthe the hash from the job's arguments if the first element a Hash.\r\n\r\n","created_at":"2018-03-05T11:09:15Z","updated_at":"2018-03-05T11:49:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"76090a54e500249b0eefa837ae39979384070816","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/zendesk/resque-disable-job/pulls/11/commits","review_comments_url":"https://api.github.com/repos/zendesk/resque-disable-job/pulls/11/comments","review_comment_url":"https://api.github.com/repos/zendesk/resque-disable-job/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zendesk/resque-disable-job/issues/11/comments","statuses_url":"https://api.github.com/repos/zendesk/resque-disable-job/statuses/f9a0c52177b263c5ea0550d0260e30c6669d2dea","head":{"label":"zendesk:andreionut/support_hash","ref":"andreionut/support_hash","sha":"f9a0c52177b263c5ea0550d0260e30c6669d2dea","user":{"login":"zendesk","id":11525,"avatar_url":"https://avatars3.githubusercontent.com/u/11525?v=4","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"repo":{"id":109863970,"name":"resque-disable-job","full_name":"zendesk/resque-disable-job","owner":{"login":"zendesk","id":11525,"avatar_url":"https://avatars3.githubusercontent.com/u/11525?v=4","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zendesk/resque-disable-job","description":"Resque Disable Job Plugin","fork":false,"url":"https://api.github.com/repos/zendesk/resque-disable-job","forks_url":"https://api.github.com/repos/zendesk/resque-disable-job/forks","keys_url":"https://api.github.com/repos/zendesk/resque-disable-job/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zendesk/resque-disable-job/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zendesk/resque-disable-job/teams","hooks_url":"https://api.github.com/repos/zendesk/resque-disable-job/hooks","issue_events_url":"https://api.github.com/repos/zendesk/resque-disable-job/issues/events{/number}","events_url":"https://api.github.com/repos/zendesk/resque-disable-job/events","assignees_url":"https://api.github.com/repos/zendesk/resque-disable-job/assignees{/user}","branches_url":"https://api.github.com/repos/zendesk/resque-disable-job/branches{/branch}","tags_url":"https://api.github.com/repos/zendesk/resque-disable-job/tags","blobs_url":"https://api.github.com/repos/zendesk/resque-disable-job/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zendesk/resque-disable-job/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zendesk/resque-disable-job/git/refs{/sha}","trees_url":"https://api.github.com/repos/zendesk/resque-disable-job/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zendesk/resque-disable-job/statuses/{sha}","languages_url":"https://api.github.com/repos/zendesk/resque-disable-job/languages","stargazers_url":"https://api.github.com/repos/zendesk/resque-disable-job/stargazers","contributors_url":"https://api.github.com/repos/zendesk/resque-disable-job/contributors","subscribers_url":"https://api.github.com/repos/zendesk/resque-disable-job/subscribers","subscription_url":"https://api.github.com/repos/zendesk/resque-disable-job/subscription","commits_url":"https://api.github.com/repos/zendesk/resque-disable-job/commits{/sha}","git_commits_url":"https://api.github.com/repos/zendesk/resque-disable-job/git/commits{/sha}","comments_url":"https://api.github.com/repos/zendesk/resque-disable-job/comments{/number}","issue_comment_url":"https://api.github.com/repos/zendesk/resque-disable-job/issues/comments{/number}","contents_url":"https://api.github.com/repos/zendesk/resque-disable-job/contents/{+path}","compare_url":"https://api.github.com/repos/zendesk/resque-disable-job/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zendesk/resque-disable-job/merges","archive_url":"https://api.github.com/repos/zendesk/resque-disable-job/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zendesk/resque-disable-job/downloads","issues_url":"https://api.github.com/repos/zendesk/resque-disable-job/issues{/number}","pulls_url":"https://api.github.com/repos/zendesk/resque-disable-job/pulls{/number}","milestones_url":"https://api.github.com/repos/zendesk/resque-disable-job/milestones{/number}","notifications_url":"https://api.github.com/repos/zendesk/resque-disable-job/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zendesk/resque-disable-job/labels{/name}","releases_url":"https://api.github.com/repos/zendesk/resque-disable-job/releases{/id}","deployments_url":"https://api.github.com/repos/zendesk/resque-disable-job/deployments","created_at":"2017-11-07T16:47:13Z","updated_at":"2017-12-06T13:19:13Z","pushed_at":"2018-03-05T11:12:09Z","git_url":"git://github.com/zendesk/resque-disable-job.git","ssh_url":"git@github.com:zendesk/resque-disable-job.git","clone_url":"https://github.com/zendesk/resque-disable-job.git","svn_url":"https://github.com/zendesk/resque-disable-job","homepage":null,"size":118,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"zendesk:master","ref":"master","sha":"48fb4042322f71ed78636f60124139ba3096dc09","user":{"login":"zendesk","id":11525,"avatar_url":"https://avatars3.githubusercontent.com/u/11525?v=4","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"repo":{"id":109863970,"name":"resque-disable-job","full_name":"zendesk/resque-disable-job","owner":{"login":"zendesk","id":11525,"avatar_url":"https://avatars3.githubusercontent.com/u/11525?v=4","gravatar_id":"","url":"https://api.github.com/users/zendesk","html_url":"https://github.com/zendesk","followers_url":"https://api.github.com/users/zendesk/followers","following_url":"https://api.github.com/users/zendesk/following{/other_user}","gists_url":"https://api.github.com/users/zendesk/gists{/gist_id}","starred_url":"https://api.github.com/users/zendesk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zendesk/subscriptions","organizations_url":"https://api.github.com/users/zendesk/orgs","repos_url":"https://api.github.com/users/zendesk/repos","events_url":"https://api.github.com/users/zendesk/events{/privacy}","received_events_url":"https://api.github.com/users/zendesk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zendesk/resque-disable-job","description":"Resque Disable Job Plugin","fork":false,"url":"https://api.github.com/repos/zendesk/resque-disable-job","forks_url":"https://api.github.com/repos/zendesk/resque-disable-job/forks","keys_url":"https://api.github.com/repos/zendesk/resque-disable-job/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zendesk/resque-disable-job/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zendesk/resque-disable-job/teams","hooks_url":"https://api.github.com/repos/zendesk/resque-disable-job/hooks","issue_events_url":"https://api.github.com/repos/zendesk/resque-disable-job/issues/events{/number}","events_url":"https://api.github.com/repos/zendesk/resque-disable-job/events","assignees_url":"https://api.github.com/repos/zendesk/resque-disable-job/assignees{/user}","branches_url":"https://api.github.com/repos/zendesk/resque-disable-job/branches{/branch}","tags_url":"https://api.github.com/repos/zendesk/resque-disable-job/tags","blobs_url":"https://api.github.com/repos/zendesk/resque-disable-job/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zendesk/resque-disable-job/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zendesk/resque-disable-job/git/refs{/sha}","trees_url":"https://api.github.com/repos/zendesk/resque-disable-job/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zendesk/resque-disable-job/statuses/{sha}","languages_url":"https://api.github.com/repos/zendesk/resque-disable-job/languages","stargazers_url":"https://api.github.com/repos/zendesk/resque-disable-job/stargazers","contributors_url":"https://api.github.com/repos/zendesk/resque-disable-job/contributors","subscribers_url":"https://api.github.com/repos/zendesk/resque-disable-job/subscribers","subscription_url":"https://api.github.com/repos/zendesk/resque-disable-job/subscription","commits_url":"https://api.github.com/repos/zendesk/resque-disable-job/commits{/sha}","git_commits_url":"https://api.github.com/repos/zendesk/resque-disable-job/git/commits{/sha}","comments_url":"https://api.github.com/repos/zendesk/resque-disable-job/comments{/number}","issue_comment_url":"https://api.github.com/repos/zendesk/resque-disable-job/issues/comments{/number}","contents_url":"https://api.github.com/repos/zendesk/resque-disable-job/contents/{+path}","compare_url":"https://api.github.com/repos/zendesk/resque-disable-job/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zendesk/resque-disable-job/merges","archive_url":"https://api.github.com/repos/zendesk/resque-disable-job/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zendesk/resque-disable-job/downloads","issues_url":"https://api.github.com/repos/zendesk/resque-disable-job/issues{/number}","pulls_url":"https://api.github.com/repos/zendesk/resque-disable-job/pulls{/number}","milestones_url":"https://api.github.com/repos/zendesk/resque-disable-job/milestones{/number}","notifications_url":"https://api.github.com/repos/zendesk/resque-disable-job/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zendesk/resque-disable-job/labels{/name}","releases_url":"https://api.github.com/repos/zendesk/resque-disable-job/releases{/id}","deployments_url":"https://api.github.com/repos/zendesk/resque-disable-job/deployments","created_at":"2017-11-07T16:47:13Z","updated_at":"2017-12-06T13:19:13Z","pushed_at":"2018-03-05T11:12:09Z","git_url":"git://github.com/zendesk/resque-disable-job.git","ssh_url":"git@github.com:zendesk/resque-disable-job.git","clone_url":"https://github.com/zendesk/resque-disable-job.git","svn_url":"https://github.com/zendesk/resque-disable-job","homepage":null,"size":118,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zendesk/resque-disable-job/pulls/11"},"html":{"href":"https://github.com/zendesk/resque-disable-job/pull/11"},"issue":{"href":"https://api.github.com/repos/zendesk/resque-disable-job/issues/11"},"comments":{"href":"https://api.github.com/repos/zendesk/resque-disable-job/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/zendesk/resque-disable-job/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/zendesk/resque-disable-job/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zendesk/resque-disable-job/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/zendesk/resque-disable-job/statuses/f9a0c52177b263c5ea0550d0260e30c6669d2dea"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"gerardc"}}