{"action":"created","comment":{"url":"https://api.github.com/repos/faradayio/ecs_compose/pulls/comments/47897461","id":47897461,"diff_hunk":"@@ -8,15 +8,22 @@ module Compare\n     def self.sort_recursively(val)\n       case val\n       when Array\n-        val.sort_by do |item|\n-          if item.instance_of?(Hash)\n-            item.to_a.sort\n-          elsif item.instance_of?(Array)\n-            # for an array of arrays, just return 1\n-            1\n+        val.sort do |a, b|\n+          a1 = if a.instance_of?(Hash)\n+            a.to_a.sort\n+          elsif a.instance_of?(Array)\n+            a.sort\n           else \n-            item\n+            a\n           end\n+          b1 = if b.instance_of?(Hash)\n+            b.to_a.sort\n+          elsif b.instance_of?(Array)\n+            b.sort\n+          else \n+            b\n+          end\n+          a1 <=> b1 || 1","path":"lib/ecs_compose/compare.rb","position":26,"original_position":26,"commit_id":"c9c95d7dd6cb7ca4a1ce2601410d4eb8756b95d6","original_commit_id":"c9c95d7dd6cb7ca4a1ce2601410d4eb8756b95d6","user":{"login":"emk","id":36963,"avatar_url":"https://avatars.githubusercontent.com/u/36963?v=3","gravatar_id":"","url":"https://api.github.com/users/emk","html_url":"https://github.com/emk","followers_url":"https://api.github.com/users/emk/followers","following_url":"https://api.github.com/users/emk/following{/other_user}","gists_url":"https://api.github.com/users/emk/gists{/gist_id}","starred_url":"https://api.github.com/users/emk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emk/subscriptions","organizations_url":"https://api.github.com/users/emk/orgs","repos_url":"https://api.github.com/users/emk/repos","events_url":"https://api.github.com/users/emk/events{/privacy}","received_events_url":"https://api.github.com/users/emk/received_events","type":"User","site_admin":false},"body":"`a1 <=> b1` is not an ordering, unfortunately.\r\n\r\nAn ordering should change sign when the arguments are swapped:\r\n\r\n```\r\nirb(main):004:0> 1 <=> 2\r\n=> -1\r\nirb(main):005:0> 2 <=> 1\r\n=> 1\r\n```\r\n\r\nBut we have:\r\n\r\n```\r\nirb(main):007:0> (nil <=> 1) || 1\r\n=> 1\r\nirb(main):008:0> (1 <=> nil) || 1\r\n=> 1\r\n```\r\n\r\nThis will produce bad weirdness:\r\n\r\n```\r\nirb(main):009:0> [nil, 1, nil, 2, nil].sort {|a,b| a <=> b || 1 }\r\n=> [nil, nil, 1, 2, nil]\r\n```","created_at":"2015-12-17T11:54:04Z","updated_at":"2015-12-17T11:54:04Z","html_url":"https://github.com/faradayio/ecs_compose/pull/2#discussion_r47897461","pull_request_url":"https://api.github.com/repos/faradayio/ecs_compose/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/faradayio/ecs_compose/pulls/comments/47897461"},"html":{"href":"https://github.com/faradayio/ecs_compose/pull/2#discussion_r47897461"},"pull_request":{"href":"https://api.github.com/repos/faradayio/ecs_compose/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/faradayio/ecs_compose/pulls/2","id":53923499,"html_url":"https://github.com/faradayio/ecs_compose/pull/2","diff_url":"https://github.com/faradayio/ecs_compose/pull/2.diff","patch_url":"https://github.com/faradayio/ecs_compose/pull/2.patch","issue_url":"https://api.github.com/repos/faradayio/ecs_compose/issues/2","number":2,"state":"open","locked":false,"title":"fixes #1 recursive sort","user":{"login":"seamusabshere","id":15787,"avatar_url":"https://avatars.githubusercontent.com/u/15787?v=3","gravatar_id":"","url":"https://api.github.com/users/seamusabshere","html_url":"https://github.com/seamusabshere","followers_url":"https://api.github.com/users/seamusabshere/followers","following_url":"https://api.github.com/users/seamusabshere/following{/other_user}","gists_url":"https://api.github.com/users/seamusabshere/gists{/gist_id}","starred_url":"https://api.github.com/users/seamusabshere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seamusabshere/subscriptions","organizations_url":"https://api.github.com/users/seamusabshere/orgs","repos_url":"https://api.github.com/users/seamusabshere/repos","events_url":"https://api.github.com/users/seamusabshere/events{/privacy}","received_events_url":"https://api.github.com/users/seamusabshere/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-17T01:27:40Z","updated_at":"2015-12-17T11:54:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"48b30a686be8d75c1e7f01dcbd7b81c0c36a3fc4","assignee":{"login":"emk","id":36963,"avatar_url":"https://avatars.githubusercontent.com/u/36963?v=3","gravatar_id":"","url":"https://api.github.com/users/emk","html_url":"https://github.com/emk","followers_url":"https://api.github.com/users/emk/followers","following_url":"https://api.github.com/users/emk/following{/other_user}","gists_url":"https://api.github.com/users/emk/gists{/gist_id}","starred_url":"https://api.github.com/users/emk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emk/subscriptions","organizations_url":"https://api.github.com/users/emk/orgs","repos_url":"https://api.github.com/users/emk/repos","events_url":"https://api.github.com/users/emk/events{/privacy}","received_events_url":"https://api.github.com/users/emk/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/faradayio/ecs_compose/pulls/2/commits","review_comments_url":"https://api.github.com/repos/faradayio/ecs_compose/pulls/2/comments","review_comment_url":"https://api.github.com/repos/faradayio/ecs_compose/pulls/comments{/number}","comments_url":"https://api.github.com/repos/faradayio/ecs_compose/issues/2/comments","statuses_url":"https://api.github.com/repos/faradayio/ecs_compose/statuses/c9c95d7dd6cb7ca4a1ce2601410d4eb8756b95d6","head":{"label":"faradayio:fix-recursive-sort","ref":"fix-recursive-sort","sha":"c9c95d7dd6cb7ca4a1ce2601410d4eb8756b95d6","user":{"login":"faradayio","id":140344,"avatar_url":"https://avatars.githubusercontent.com/u/140344?v=3","gravatar_id":"","url":"https://api.github.com/users/faradayio","html_url":"https://github.com/faradayio","followers_url":"https://api.github.com/users/faradayio/followers","following_url":"https://api.github.com/users/faradayio/following{/other_user}","gists_url":"https://api.github.com/users/faradayio/gists{/gist_id}","starred_url":"https://api.github.com/users/faradayio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faradayio/subscriptions","organizations_url":"https://api.github.com/users/faradayio/orgs","repos_url":"https://api.github.com/users/faradayio/repos","events_url":"https://api.github.com/users/faradayio/events{/privacy}","received_events_url":"https://api.github.com/users/faradayio/received_events","type":"Organization","site_admin":false},"repo":{"id":40006865,"name":"ecs_compose","full_name":"faradayio/ecs_compose","owner":{"login":"faradayio","id":140344,"avatar_url":"https://avatars.githubusercontent.com/u/140344?v=3","gravatar_id":"","url":"https://api.github.com/users/faradayio","html_url":"https://github.com/faradayio","followers_url":"https://api.github.com/users/faradayio/followers","following_url":"https://api.github.com/users/faradayio/following{/other_user}","gists_url":"https://api.github.com/users/faradayio/gists{/gist_id}","starred_url":"https://api.github.com/users/faradayio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faradayio/subscriptions","organizations_url":"https://api.github.com/users/faradayio/orgs","repos_url":"https://api.github.com/users/faradayio/repos","events_url":"https://api.github.com/users/faradayio/events{/privacy}","received_events_url":"https://api.github.com/users/faradayio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/faradayio/ecs_compose","description":"WORK IN PROGRESS: docker-compose.yml-based interface for Amazon EC2 Container Service (ECS)","fork":false,"url":"https://api.github.com/repos/faradayio/ecs_compose","forks_url":"https://api.github.com/repos/faradayio/ecs_compose/forks","keys_url":"https://api.github.com/repos/faradayio/ecs_compose/keys{/key_id}","collaborators_url":"https://api.github.com/repos/faradayio/ecs_compose/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/faradayio/ecs_compose/teams","hooks_url":"https://api.github.com/repos/faradayio/ecs_compose/hooks","issue_events_url":"https://api.github.com/repos/faradayio/ecs_compose/issues/events{/number}","events_url":"https://api.github.com/repos/faradayio/ecs_compose/events","assignees_url":"https://api.github.com/repos/faradayio/ecs_compose/assignees{/user}","branches_url":"https://api.github.com/repos/faradayio/ecs_compose/branches{/branch}","tags_url":"https://api.github.com/repos/faradayio/ecs_compose/tags","blobs_url":"https://api.github.com/repos/faradayio/ecs_compose/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/faradayio/ecs_compose/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/faradayio/ecs_compose/git/refs{/sha}","trees_url":"https://api.github.com/repos/faradayio/ecs_compose/git/trees{/sha}","statuses_url":"https://api.github.com/repos/faradayio/ecs_compose/statuses/{sha}","languages_url":"https://api.github.com/repos/faradayio/ecs_compose/languages","stargazers_url":"https://api.github.com/repos/faradayio/ecs_compose/stargazers","contributors_url":"https://api.github.com/repos/faradayio/ecs_compose/contributors","subscribers_url":"https://api.github.com/repos/faradayio/ecs_compose/subscribers","subscription_url":"https://api.github.com/repos/faradayio/ecs_compose/subscription","commits_url":"https://api.github.com/repos/faradayio/ecs_compose/commits{/sha}","git_commits_url":"https://api.github.com/repos/faradayio/ecs_compose/git/commits{/sha}","comments_url":"https://api.github.com/repos/faradayio/ecs_compose/comments{/number}","issue_comment_url":"https://api.github.com/repos/faradayio/ecs_compose/issues/comments{/number}","contents_url":"https://api.github.com/repos/faradayio/ecs_compose/contents/{+path}","compare_url":"https://api.github.com/repos/faradayio/ecs_compose/compare/{base}...{head}","merges_url":"https://api.github.com/repos/faradayio/ecs_compose/merges","archive_url":"https://api.github.com/repos/faradayio/ecs_compose/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/faradayio/ecs_compose/downloads","issues_url":"https://api.github.com/repos/faradayio/ecs_compose/issues{/number}","pulls_url":"https://api.github.com/repos/faradayio/ecs_compose/pulls{/number}","milestones_url":"https://api.github.com/repos/faradayio/ecs_compose/milestones{/number}","notifications_url":"https://api.github.com/repos/faradayio/ecs_compose/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/faradayio/ecs_compose/labels{/name}","releases_url":"https://api.github.com/repos/faradayio/ecs_compose/releases{/id}","created_at":"2015-07-31T13:35:10Z","updated_at":"2015-10-01T11:33:55Z","pushed_at":"2015-12-17T01:27:41Z","git_url":"git://github.com/faradayio/ecs_compose.git","ssh_url":"git@github.com:faradayio/ecs_compose.git","clone_url":"https://github.com/faradayio/ecs_compose.git","svn_url":"https://github.com/faradayio/ecs_compose","homepage":null,"size":57,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":2,"default_branch":"master"}},"base":{"label":"faradayio:master","ref":"master","sha":"efaa1b855573245a389c1843d84c97671f171ca0","user":{"login":"faradayio","id":140344,"avatar_url":"https://avatars.githubusercontent.com/u/140344?v=3","gravatar_id":"","url":"https://api.github.com/users/faradayio","html_url":"https://github.com/faradayio","followers_url":"https://api.github.com/users/faradayio/followers","following_url":"https://api.github.com/users/faradayio/following{/other_user}","gists_url":"https://api.github.com/users/faradayio/gists{/gist_id}","starred_url":"https://api.github.com/users/faradayio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faradayio/subscriptions","organizations_url":"https://api.github.com/users/faradayio/orgs","repos_url":"https://api.github.com/users/faradayio/repos","events_url":"https://api.github.com/users/faradayio/events{/privacy}","received_events_url":"https://api.github.com/users/faradayio/received_events","type":"Organization","site_admin":false},"repo":{"id":40006865,"name":"ecs_compose","full_name":"faradayio/ecs_compose","owner":{"login":"faradayio","id":140344,"avatar_url":"https://avatars.githubusercontent.com/u/140344?v=3","gravatar_id":"","url":"https://api.github.com/users/faradayio","html_url":"https://github.com/faradayio","followers_url":"https://api.github.com/users/faradayio/followers","following_url":"https://api.github.com/users/faradayio/following{/other_user}","gists_url":"https://api.github.com/users/faradayio/gists{/gist_id}","starred_url":"https://api.github.com/users/faradayio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/faradayio/subscriptions","organizations_url":"https://api.github.com/users/faradayio/orgs","repos_url":"https://api.github.com/users/faradayio/repos","events_url":"https://api.github.com/users/faradayio/events{/privacy}","received_events_url":"https://api.github.com/users/faradayio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/faradayio/ecs_compose","description":"WORK IN PROGRESS: docker-compose.yml-based interface for Amazon EC2 Container Service (ECS)","fork":false,"url":"https://api.github.com/repos/faradayio/ecs_compose","forks_url":"https://api.github.com/repos/faradayio/ecs_compose/forks","keys_url":"https://api.github.com/repos/faradayio/ecs_compose/keys{/key_id}","collaborators_url":"https://api.github.com/repos/faradayio/ecs_compose/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/faradayio/ecs_compose/teams","hooks_url":"https://api.github.com/repos/faradayio/ecs_compose/hooks","issue_events_url":"https://api.github.com/repos/faradayio/ecs_compose/issues/events{/number}","events_url":"https://api.github.com/repos/faradayio/ecs_compose/events","assignees_url":"https://api.github.com/repos/faradayio/ecs_compose/assignees{/user}","branches_url":"https://api.github.com/repos/faradayio/ecs_compose/branches{/branch}","tags_url":"https://api.github.com/repos/faradayio/ecs_compose/tags","blobs_url":"https://api.github.com/repos/faradayio/ecs_compose/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/faradayio/ecs_compose/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/faradayio/ecs_compose/git/refs{/sha}","trees_url":"https://api.github.com/repos/faradayio/ecs_compose/git/trees{/sha}","statuses_url":"https://api.github.com/repos/faradayio/ecs_compose/statuses/{sha}","languages_url":"https://api.github.com/repos/faradayio/ecs_compose/languages","stargazers_url":"https://api.github.com/repos/faradayio/ecs_compose/stargazers","contributors_url":"https://api.github.com/repos/faradayio/ecs_compose/contributors","subscribers_url":"https://api.github.com/repos/faradayio/ecs_compose/subscribers","subscription_url":"https://api.github.com/repos/faradayio/ecs_compose/subscription","commits_url":"https://api.github.com/repos/faradayio/ecs_compose/commits{/sha}","git_commits_url":"https://api.github.com/repos/faradayio/ecs_compose/git/commits{/sha}","comments_url":"https://api.github.com/repos/faradayio/ecs_compose/comments{/number}","issue_comment_url":"https://api.github.com/repos/faradayio/ecs_compose/issues/comments{/number}","contents_url":"https://api.github.com/repos/faradayio/ecs_compose/contents/{+path}","compare_url":"https://api.github.com/repos/faradayio/ecs_compose/compare/{base}...{head}","merges_url":"https://api.github.com/repos/faradayio/ecs_compose/merges","archive_url":"https://api.github.com/repos/faradayio/ecs_compose/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/faradayio/ecs_compose/downloads","issues_url":"https://api.github.com/repos/faradayio/ecs_compose/issues{/number}","pulls_url":"https://api.github.com/repos/faradayio/ecs_compose/pulls{/number}","milestones_url":"https://api.github.com/repos/faradayio/ecs_compose/milestones{/number}","notifications_url":"https://api.github.com/repos/faradayio/ecs_compose/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/faradayio/ecs_compose/labels{/name}","releases_url":"https://api.github.com/repos/faradayio/ecs_compose/releases{/id}","created_at":"2015-07-31T13:35:10Z","updated_at":"2015-10-01T11:33:55Z","pushed_at":"2015-12-17T01:27:41Z","git_url":"git://github.com/faradayio/ecs_compose.git","ssh_url":"git@github.com:faradayio/ecs_compose.git","clone_url":"https://github.com/faradayio/ecs_compose.git","svn_url":"https://github.com/faradayio/ecs_compose","homepage":null,"size":57,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/faradayio/ecs_compose/pulls/2"},"html":{"href":"https://github.com/faradayio/ecs_compose/pull/2"},"issue":{"href":"https://api.github.com/repos/faradayio/ecs_compose/issues/2"},"comments":{"href":"https://api.github.com/repos/faradayio/ecs_compose/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/faradayio/ecs_compose/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/faradayio/ecs_compose/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/faradayio/ecs_compose/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/faradayio/ecs_compose/statuses/c9c95d7dd6cb7ca4a1ce2601410d4eb8756b95d6"}}}}