{"action":"created","issue":{"url":"https://api.github.com/repos/wvanbergen/chunky_png/issues/85","labels_url":"https://api.github.com/repos/wvanbergen/chunky_png/issues/85/labels{/name}","comments_url":"https://api.github.com/repos/wvanbergen/chunky_png/issues/85/comments","events_url":"https://api.github.com/repos/wvanbergen/chunky_png/issues/85/events","html_url":"https://github.com/wvanbergen/chunky_png/issues/85","id":63435199,"number":85,"title":"Color.from_hsv exception when hue is 360.0","user":{"login":"wconrad","id":1935752,"avatar_url":"https://avatars.githubusercontent.com/u/1935752?v=3","gravatar_id":"","url":"https://api.github.com/users/wconrad","html_url":"https://github.com/wconrad","followers_url":"https://api.github.com/users/wconrad/followers","following_url":"https://api.github.com/users/wconrad/following{/other_user}","gists_url":"https://api.github.com/users/wconrad/gists{/gist_id}","starred_url":"https://api.github.com/users/wconrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wconrad/subscriptions","organizations_url":"https://api.github.com/users/wconrad/orgs","repos_url":"https://api.github.com/users/wconrad/repos","events_url":"https://api.github.com/users/wconrad/events{/privacy}","received_events_url":"https://api.github.com/users/wconrad/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-03-21T17:55:21Z","updated_at":"2015-03-21T20:23:35Z","closed_at":null,"body":"The docs for Color.from_hsv claim that hue can range from 0 through 360:\r\n\r\n    # @param [Fixnum] hue The hue component (0-360)\r\n\r\nBut if a hue of 360 is given:\r\n\r\n    gem \"chunky_png\", \"1.3.4\"\r\n    require \"chunky_png\"\r\n    ChunkyPNG::Color.from_hsv(360.0, 1.0, 1.0)\r\n\r\nThen an exception is thrown:\r\n\r\n```\r\n/home/wayne/.rvm/gems/ruby-2.2.0/gems/chunky_png-1.3.4/lib/chunky_png/color.rb:199:in `from_hsv': undefined method `map!' for nil:NilClass (NoMethodError)\r\n        from /tmp/chunky.rb:5:in `<main>'\r\n```\r\n\r\nIf the docs are correct, then a `hue %= 360` in #cylindrical_to_cubic will fix the code.  If the code is correct, then the docs should probably indicate that the upper limit is exclusive rather than inclusive.  Perhaps using the Ruby range notation of three dots for exclusive and two dots for inclusive would do it:\r\n\r\n    # @param [Fixnum] hue The hue component (0...360)\r\n    # @param [Fixnum] saturation The saturation component (0..1)\r\n    # @param [Fixnum] value The value (brightness) component (0..1)\r\n\r\nThis issue affects .from_hsl as well.\r\n\r\nWhichever is wrong, the docs or the code, I'd be glad to create a pull request for it."},"comment":{"url":"https://api.github.com/repos/wvanbergen/chunky_png/issues/comments/84449582","html_url":"https://github.com/wvanbergen/chunky_png/issues/85#issuecomment-84449582","issue_url":"https://api.github.com/repos/wvanbergen/chunky_png/issues/85","id":84449582,"user":{"login":"wconrad","id":1935752,"avatar_url":"https://avatars.githubusercontent.com/u/1935752?v=3","gravatar_id":"","url":"https://api.github.com/users/wconrad","html_url":"https://github.com/wconrad","followers_url":"https://api.github.com/users/wconrad/followers","following_url":"https://api.github.com/users/wconrad/following{/other_user}","gists_url":"https://api.github.com/users/wconrad/gists{/gist_id}","starred_url":"https://api.github.com/users/wconrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wconrad/subscriptions","organizations_url":"https://api.github.com/users/wconrad/orgs","repos_url":"https://api.github.com/users/wconrad/repos","events_url":"https://api.github.com/users/wconrad/events{/privacy}","received_events_url":"https://api.github.com/users/wconrad/received_events","type":"User","site_admin":false},"created_at":"2015-03-21T20:23:35Z","updated_at":"2015-03-21T20:23:35Z","body":"Sorry about the mess.  I had a couple of force pushes to my fork before I got it right.  The last one (808c147) is correct."}}