{"action":"created","comment":{"url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments/36435004","id":36435004,"diff_hunk":"@@ -29,8 +29,15 @@ def del(key)\n   end\n \n   def hdel(key, field)\n-    value = get_hash_for_key(key).delete(field)\n-    value ? 1 : 0\n+    if field.is_a?(Array)\n+      field.reduce(0) do |memo, next_field|\n+        value = get_hash_for_key(key).delete(next_field)\n+        memo + (value ? 1 : 0)\n+      end\n+    else\n+      value = get_hash_for_key(key).delete(field)","path":"shared/test/fake_redis_client.rb","position":12,"original_position":12,"commit_id":"3b45e70b2953f092fccf129850c0a28833aab314","original_commit_id":"3b45e70b2953f092fccf129850c0a28833aab314","user":{"login":"philbogle","id":5198586,"avatar_url":"https://avatars.githubusercontent.com/u/5198586?v=3","gravatar_id":"","url":"https://api.github.com/users/philbogle","html_url":"https://github.com/philbogle","followers_url":"https://api.github.com/users/philbogle/followers","following_url":"https://api.github.com/users/philbogle/following{/other_user}","gists_url":"https://api.github.com/users/philbogle/gists{/gist_id}","starred_url":"https://api.github.com/users/philbogle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philbogle/subscriptions","organizations_url":"https://api.github.com/users/philbogle/orgs","repos_url":"https://api.github.com/users/philbogle/repos","events_url":"https://api.github.com/users/philbogle/events{/privacy}","received_events_url":"https://api.github.com/users/philbogle/received_events","type":"User","site_admin":false},"body":"Perhaps you could avoid code duplication this to the array case by adding a line at the top of the method:\r\nfields = [fields] unless fields.is_a?(Array)","created_at":"2015-08-06T16:27:31Z","updated_at":"2015-08-06T16:27:31Z","html_url":"https://github.com/code-dot-org/code-dot-org/pull/3417#discussion_r36435004","pull_request_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/3417","_links":{"self":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments/36435004"},"html":{"href":"https://github.com/code-dot-org/code-dot-org/pull/3417#discussion_r36435004"},"pull_request":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/3417"}}},"pull_request":{"url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/3417","id":41782333,"html_url":"https://github.com/code-dot-org/code-dot-org/pull/3417","diff_url":"https://github.com/code-dot-org/code-dot-org/pull/3417.diff","patch_url":"https://github.com/code-dot-org/code-dot-org/pull/3417.patch","issue_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/3417","number":3417,"state":"open","locked":false,"title":"NetSim: delete_many (server-side)","user":{"login":"islemaster","id":1615761,"avatar_url":"https://avatars.githubusercontent.com/u/1615761?v=3","gravatar_id":"","url":"https://api.github.com/users/islemaster","html_url":"https://github.com/islemaster","followers_url":"https://api.github.com/users/islemaster/followers","following_url":"https://api.github.com/users/islemaster/following{/other_user}","gists_url":"https://api.github.com/users/islemaster/gists{/gist_id}","starred_url":"https://api.github.com/users/islemaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/islemaster/subscriptions","organizations_url":"https://api.github.com/users/islemaster/orgs","repos_url":"https://api.github.com/users/islemaster/repos","events_url":"https://api.github.com/users/islemaster/events{/privacy}","received_events_url":"https://api.github.com/users/islemaster/received_events","type":"User","site_admin":false},"body":"Adds two new routes to `NetSimApi`:\r\n\r\n* DELETE v3/netsim/<shard-id>/<table-name>?id[]=<id1>&id[]=<id2>&...\r\n* POST v3/netsim/<shard-id>/<table-name>/delete?id[]=<id1>&id[]=<id2>&...\r\n\r\nBoth point to a delete_many operation that removes several rows from the table in a single operation, resulting in a single invalidation.\r\n\r\nThis is implemented through the [Redis HDEL command](http://redis.io/commands/hdel) (exposed as the [hdel instance method in the Ruby API](http://www.rubydoc.info/github/redis/redis-rb/Redis#hdel-instance_method).  The second argument accepts either a `String` or an `Array<String>`; I simply extended our `RedisPropertyBag.delete` implementation to support both as well.  For tests, I had to update `fake_redis_client.rb` to also accept an array as a second argument. ","created_at":"2015-08-06T12:31:46Z","updated_at":"2015-08-06T16:27:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2d7f5e7a724cbe41223e3bc16f429a06d936aa22","assignee":{"login":"philbogle","id":5198586,"avatar_url":"https://avatars.githubusercontent.com/u/5198586?v=3","gravatar_id":"","url":"https://api.github.com/users/philbogle","html_url":"https://github.com/philbogle","followers_url":"https://api.github.com/users/philbogle/followers","following_url":"https://api.github.com/users/philbogle/following{/other_user}","gists_url":"https://api.github.com/users/philbogle/gists{/gist_id}","starred_url":"https://api.github.com/users/philbogle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/philbogle/subscriptions","organizations_url":"https://api.github.com/users/philbogle/orgs","repos_url":"https://api.github.com/users/philbogle/repos","events_url":"https://api.github.com/users/philbogle/events{/privacy}","received_events_url":"https://api.github.com/users/philbogle/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/3417/commits","review_comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/3417/comments","review_comment_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments{/number}","comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/3417/comments","statuses_url":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/3b45e70b2953f092fccf129850c0a28833aab314","head":{"label":"code-dot-org:netsim-multi-delete","ref":"netsim-multi-delete","sha":"3b45e70b2953f092fccf129850c0a28833aab314","user":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"repo":{"id":24250009,"name":"code-dot-org","full_name":"code-dot-org/code-dot-org","owner":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/code-dot-org/code-dot-org","description":"The code powering code.org and studio.code.org","fork":false,"url":"https://api.github.com/repos/code-dot-org/code-dot-org","forks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/forks","keys_url":"https://api.github.com/repos/code-dot-org/code-dot-org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/code-dot-org/code-dot-org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/code-dot-org/code-dot-org/teams","hooks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/hooks","issue_events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/events{/number}","events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/events","assignees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/assignees{/user}","branches_url":"https://api.github.com/repos/code-dot-org/code-dot-org/branches{/branch}","tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/tags","blobs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/refs{/sha}","trees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/{sha}","languages_url":"https://api.github.com/repos/code-dot-org/code-dot-org/languages","stargazers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/stargazers","contributors_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contributors","subscribers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscribers","subscription_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscription","commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/commits{/sha}","git_commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/commits{/sha}","comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/comments{/number}","issue_comment_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/comments{/number}","contents_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contents/{+path}","compare_url":"https://api.github.com/repos/code-dot-org/code-dot-org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/code-dot-org/code-dot-org/merges","archive_url":"https://api.github.com/repos/code-dot-org/code-dot-org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/code-dot-org/code-dot-org/downloads","issues_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues{/number}","pulls_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls{/number}","milestones_url":"https://api.github.com/repos/code-dot-org/code-dot-org/milestones{/number}","notifications_url":"https://api.github.com/repos/code-dot-org/code-dot-org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/code-dot-org/code-dot-org/labels{/name}","releases_url":"https://api.github.com/repos/code-dot-org/code-dot-org/releases{/id}","created_at":"2014-09-20T00:46:11Z","updated_at":"2015-07-11T11:09:37Z","pushed_at":"2015-08-06T12:31:46Z","git_url":"git://github.com/code-dot-org/code-dot-org.git","ssh_url":"git@github.com:code-dot-org/code-dot-org.git","clone_url":"https://github.com/code-dot-org/code-dot-org.git","svn_url":"https://github.com/code-dot-org/code-dot-org","homepage":"http://code.org","size":2408666,"stargazers_count":49,"watchers_count":49,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":29,"forks":35,"open_issues":29,"watchers":49,"default_branch":"staging"}},"base":{"label":"code-dot-org:staging","ref":"staging","sha":"576ab96848b6aca3de96e4a30b8bb89a8d04dbdc","user":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"repo":{"id":24250009,"name":"code-dot-org","full_name":"code-dot-org/code-dot-org","owner":{"login":"code-dot-org","id":5124627,"avatar_url":"https://avatars.githubusercontent.com/u/5124627?v=3","gravatar_id":"","url":"https://api.github.com/users/code-dot-org","html_url":"https://github.com/code-dot-org","followers_url":"https://api.github.com/users/code-dot-org/followers","following_url":"https://api.github.com/users/code-dot-org/following{/other_user}","gists_url":"https://api.github.com/users/code-dot-org/gists{/gist_id}","starred_url":"https://api.github.com/users/code-dot-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/code-dot-org/subscriptions","organizations_url":"https://api.github.com/users/code-dot-org/orgs","repos_url":"https://api.github.com/users/code-dot-org/repos","events_url":"https://api.github.com/users/code-dot-org/events{/privacy}","received_events_url":"https://api.github.com/users/code-dot-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/code-dot-org/code-dot-org","description":"The code powering code.org and studio.code.org","fork":false,"url":"https://api.github.com/repos/code-dot-org/code-dot-org","forks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/forks","keys_url":"https://api.github.com/repos/code-dot-org/code-dot-org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/code-dot-org/code-dot-org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/code-dot-org/code-dot-org/teams","hooks_url":"https://api.github.com/repos/code-dot-org/code-dot-org/hooks","issue_events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/events{/number}","events_url":"https://api.github.com/repos/code-dot-org/code-dot-org/events","assignees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/assignees{/user}","branches_url":"https://api.github.com/repos/code-dot-org/code-dot-org/branches{/branch}","tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/tags","blobs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/refs{/sha}","trees_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/{sha}","languages_url":"https://api.github.com/repos/code-dot-org/code-dot-org/languages","stargazers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/stargazers","contributors_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contributors","subscribers_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscribers","subscription_url":"https://api.github.com/repos/code-dot-org/code-dot-org/subscription","commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/commits{/sha}","git_commits_url":"https://api.github.com/repos/code-dot-org/code-dot-org/git/commits{/sha}","comments_url":"https://api.github.com/repos/code-dot-org/code-dot-org/comments{/number}","issue_comment_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/comments{/number}","contents_url":"https://api.github.com/repos/code-dot-org/code-dot-org/contents/{+path}","compare_url":"https://api.github.com/repos/code-dot-org/code-dot-org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/code-dot-org/code-dot-org/merges","archive_url":"https://api.github.com/repos/code-dot-org/code-dot-org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/code-dot-org/code-dot-org/downloads","issues_url":"https://api.github.com/repos/code-dot-org/code-dot-org/issues{/number}","pulls_url":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls{/number}","milestones_url":"https://api.github.com/repos/code-dot-org/code-dot-org/milestones{/number}","notifications_url":"https://api.github.com/repos/code-dot-org/code-dot-org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/code-dot-org/code-dot-org/labels{/name}","releases_url":"https://api.github.com/repos/code-dot-org/code-dot-org/releases{/id}","created_at":"2014-09-20T00:46:11Z","updated_at":"2015-07-11T11:09:37Z","pushed_at":"2015-08-06T12:31:46Z","git_url":"git://github.com/code-dot-org/code-dot-org.git","ssh_url":"git@github.com:code-dot-org/code-dot-org.git","clone_url":"https://github.com/code-dot-org/code-dot-org.git","svn_url":"https://github.com/code-dot-org/code-dot-org","homepage":"http://code.org","size":2408666,"stargazers_count":49,"watchers_count":49,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":35,"mirror_url":null,"open_issues_count":29,"forks":35,"open_issues":29,"watchers":49,"default_branch":"staging"}},"_links":{"self":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/3417"},"html":{"href":"https://github.com/code-dot-org/code-dot-org/pull/3417"},"issue":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/3417"},"comments":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/issues/3417/comments"},"review_comments":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/3417/comments"},"review_comment":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/pulls/3417/commits"},"statuses":{"href":"https://api.github.com/repos/code-dot-org/code-dot-org/statuses/3b45e70b2953f092fccf129850c0a28833aab314"}}}}