{"action":"created","issue":{"url":"https://api.github.com/repos/realm/jazzy/issues/473","repository_url":"https://api.github.com/repos/realm/jazzy","labels_url":"https://api.github.com/repos/realm/jazzy/issues/473/labels{/name}","comments_url":"https://api.github.com/repos/realm/jazzy/issues/473/comments","events_url":"https://api.github.com/repos/realm/jazzy/issues/473/events","html_url":"https://github.com/realm/jazzy/issues/473","id":131354710,"number":473,"title":"Order of classes not stable","user":{"login":"esad","id":11807,"avatar_url":"https://avatars.githubusercontent.com/u/11807?v=3","gravatar_id":"","url":"https://api.github.com/users/esad","html_url":"https://github.com/esad","followers_url":"https://api.github.com/users/esad/followers","following_url":"https://api.github.com/users/esad/following{/other_user}","gists_url":"https://api.github.com/users/esad/gists{/gist_id}","starred_url":"https://api.github.com/users/esad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esad/subscriptions","organizations_url":"https://api.github.com/users/esad/orgs","repos_url":"https://api.github.com/users/esad/repos","events_url":"https://api.github.com/users/esad/events{/privacy}","received_events_url":"https://api.github.com/users/esad/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-04T13:55:45Z","updated_at":"2016-02-04T15:42:13Z","closed_at":null,"body":"I'm working on updating the integration specs for #466. However, when I run rake spec from the current jazzy master it doesn't pass because the order of classes in the generated docs seems different than the one in integration specs (see screenshots).\r\n\r\nI'm using ruby 2.3.0p0\r\n\r\n![screen shot 2016-02-04 at 14 53 01](https://cloud.githubusercontent.com/assets/11807/12816891/515f877a-cb4f-11e5-992b-15a54d986e1a.png)\r\n![screen shot 2016-02-04 at 14 52 55](https://cloud.githubusercontent.com/assets/11807/12816892/51606ce4-cb4f-11e5-9c92-9f364654d167.png)\r\n"},"comment":{"url":"https://api.github.com/repos/realm/jazzy/issues/comments/179906301","html_url":"https://github.com/realm/jazzy/issues/473#issuecomment-179906301","issue_url":"https://api.github.com/repos/realm/jazzy/issues/473","id":179906301,"user":{"login":"esad","id":11807,"avatar_url":"https://avatars.githubusercontent.com/u/11807?v=3","gravatar_id":"","url":"https://api.github.com/users/esad","html_url":"https://github.com/esad","followers_url":"https://api.github.com/users/esad/followers","following_url":"https://api.github.com/users/esad/following{/other_user}","gists_url":"https://api.github.com/users/esad/gists{/gist_id}","starred_url":"https://api.github.com/users/esad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esad/subscriptions","organizations_url":"https://api.github.com/users/esad/orgs","repos_url":"https://api.github.com/users/esad/repos","events_url":"https://api.github.com/users/esad/events{/privacy}","received_events_url":"https://api.github.com/users/esad/received_events","type":"User","site_admin":false},"created_at":"2016-02-04T15:42:13Z","updated_at":"2016-02-04T15:42:13Z","body":"I think the cause for this is\r\n\r\nhttps://github.com/realm/jazzy/blob/master/lib/jazzy/doc_builder.rb#L34\r\n\r\nThere, we first sort by `name` and then by `nav_order`. In case that `nav_order` is nil (which it is for classes in realm-objc), one would think that the first sort would remain stable, but it doesn't (at least under ruby 2.3).\r\n\r\nExample:\r\n\r\n```\r\n2.3.0 :007 > %w(b z a X z Z ZZ Z).sort_by {|x| x}\r\n => [\"X\", \"Z\", \"Z\", \"ZZ\", \"a\", \"b\", \"z\", \"z\"] \r\n\r\n2.3.0 :008 > %w(b z a X z Z ZZ Z).sort_by {|x| x}.sort_by { nil }\r\n => [\"z\", \"Z\", \"Z\", \"ZZ\", \"a\", \"b\", \"z\", \"X\"] # <- Whops?\r\n\r\n# Proposed fix:\r\n2.3.0 :009 > %w(b z a X z Z ZZ Z).sort_by {|x| x}.sort_by { |x| [nil,x] }\r\n => [\"X\", \"Z\", \"Z\", \"ZZ\", \"a\", \"b\", \"z\", \"z\"] \r\n```\r\n"}}